Збирач сміття (Garbage Collector, GC) є ключовим компонентом платформи .NET, що забезпечує автоматичне керування пам'яттю та запобігає витокам. У версії .NET 9, випущеній у листопаді 2024 року, відбулися значні покращення GC, спрямовані на підвищення ефективності пам'яті, зниження латентності та адаптацію до динамічних навантажень. Основними інноваціями є активація за замовчуванням механізму DATAS (Dynamic Adaptation to Application Sizes), адаптивний Server GC та оптимізації, пов'язані з JIT-компіляцією. Ця оглядова стаття аналізує ці зміни, їх механізми, вплив на продуктивність та рекомендації щодо використання. На основі офіційної документації Microsoft та бенчмарків, демонструється зниження споживання пам'яті на 93% та зростання throughput на 15% у типових сценаріях. Стаття корисна для розробників, які працюють з високонавантаженими додатками, особливо в хмарних та контейнеризованих середовища
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Створіть generic клас Spellbook<T>, де T — тип заклинання, що реалізує інтерфейс ISpell з методами Cast() та GetPower(). | |
| Застосуйте комбіновані constraints: where T : ISpell, new(), IComparable<T> для сортування заклинань за силою, і додайте | |
| метод LearnSpell(), що додає нові заклинання з перевіркою на унікальність через IComparable. | |
| У Main() створіть Spellbook з вигаданими заклинаннями (клас Fireball та HealingWave, обидва з ISpell), або по Гарі Потеру. | |
| вивчіть 5 заклинань, відсортуйте та симулюйте кастування найсильнішого, виводячи ефекти. | |
| Додайте умовні constraints через where T : class для "темних" заклять (з додатковим інтерфейсом IDarkMagic), і метод InvokeRitual(), | |
| що комбінує заклинання лише якщо всі T задовольняють IDarkMagic, інакше кидає виняток. Тестуйте з мішаними типами в окремій Spellbook<DarkSpell>. | |
| =========================================================================================== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="uk"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Адаптивний сайт</title> | |
| <!-- базовий CSS, якщо потрібно --> | |
| </head> | |
| <body> | |
| <h1>Виявлення пристрою...</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package site.sunmeat.xml; | |
| import android.os.Bundle; | |
| import android.util.Log; | |
| import android.widget.Toast; | |
| import androidx.appcompat.app.AppCompatActivity; | |
| import org.w3c.dom.*; | |
| import org.xml.sax.SAXException; | |
| import java.io.*; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MainActivity.java: | |
| package site.sunmeat.services; | |
| import android.app.ActivityManager; | |
| import android.app.AlarmManager; | |
| import android.app.PendingIntent; | |
| import android.content.BroadcastReceiver; | |
| import android.content.Context; | |
| import android.content.Intent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MainActivity.java: | |
| package site.sunmeat.lottie; | |
| import android.os.Bundle; | |
| import androidx.annotation.NonNull; | |
| import androidx.appcompat.app.AppCompatActivity; | |
| import com.airbnb.lottie.*; | |
| import android.animation.Animator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MainActivity.java: | |
| package site.sunmeat.helloworld; | |
| import android.animation.AnimatorSet; | |
| import android.animation.ObjectAnimator; | |
| import android.os.Bundle; | |
| import android.view.animation.AccelerateDecelerateInterpolator; | |
| import android.widget.TextView; | |
| import androidx.appcompat.app.AppCompatActivity; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MainActivity.java: | |
| package site.sunmeat.animation; | |
| import android.content.Intent; | |
| import android.content.res.ColorStateList; | |
| import android.os.Bundle; | |
| import android.view.View; | |
| import android.view.animation.OvershootInterpolator; | |
| import android.widget.Button; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MainActivity.java: | |
| package site.sunmeat.opengles3d; | |
| import android.app.Activity; | |
| import android.opengl.GLSurfaceView; | |
| import android.os.Bundle; | |
| import android.opengl.GLES20; | |
| import android.opengl.Matrix; | |
| import javax.microedition.khronos.egl.EGLConfig; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MainActivity.java: | |
| package site.sunmeat.fonts; | |
| import android.graphics.Typeface; | |
| import android.os.*; | |
| import androidx.appcompat.app.AppCompatActivity; | |
| import androidx.core.content.res.ResourcesCompat; | |
| import androidx.core.provider.*; | |
| import android.widget.TextView; |