- Видео 15
- Просмотров 28 091
Sebastian Sellmair
Добавлен 18 сен 2011
Firework: Introducing Compose Hot Reload
I will document my journey of building "Compose Hot Reload" in the upcoming videos.
This video will demo the current state (16.11.2024) and briefly introduce the project.
This video will demo the current state (16.11.2024) and briefly introduce the project.
Просмотров: 2 193
Видео
Performance in Kotlin
Просмотров 1,9 тыс.Месяц назад
This video is supposed to showcase why it is important for us to use benchmarking frameworks instead of just measuring the time it took to execute some code.
I am done with ViewModels...
Просмотров 4,5 тыс.2 месяца назад
In this video, I am going to rant about ViewModels and try to explain why I personally do not like them. Obviously, I am very much over exaggerating.
Re-Implementing kotlinx.coroutines
Просмотров 2,3 тыс.3 месяца назад
In this video I will show how to re-implement the basics of kotlinx.coroutines, such as launching coroutines, Dispatchers and switching context.
Nothing is really cool in Kotlin
Просмотров 8 тыс.3 месяца назад
Explaining why the 'Nothing' type in Kotlin is cool whilst also looking into generics, covariance and contravariance.
Kotlin Multiplatform, In Detail, Step by Step Setup Guide (+Compose)
Просмотров 3,5 тыс.4 месяца назад
In-depth tutorial on how-to setup a Kotlin Multiplatform application; Targeting: Android, iOS and Desktop Using: Compose 00:00 Intro 02:11 Creating the initial settings.gradle.kts 03:25 Loading the Kotlin Multiplatform Plugin 05:22 Loading the Android Application Plugin 07:44 Setting up the ':app' module 10:19 Setup the compose plugins 11:36 Writing the first @Composable functions 13:37 Creatin...
Julian & Seb: From publishing to async/await
Просмотров 864 месяца назад
Julian & Seb: From publishing to async/await
Julian & Seb: Flutter Method Channels & Kotlin's expect/actual
Просмотров 1304 месяца назад
Julian & Seb: Flutter Method Channels & Kotlin's expect/actual
Julian & Seb: What makes Flutter great
Просмотров 3364 месяца назад
Meeting up with my old friend Julian to discuss Flutter and what is great about the technology. We'll cover the basics: Project setup, typical workflows, and more. We will also discuss which tools are important and how this relates to Kotlin, IntelliJ, and Fleet.
I messed up: Repairing a bad 'initial commit' on your new GitHub repository
Просмотров 3354 месяца назад
I pushed a GitHub repository for my previous video. When creating this repo, I was lazy and only pushed directly into master & my feature branch. However, I would like to have a proper 'initial commit' and base future video examples on this 'master'. This video shows how one can use 'git commit-tree' to fixup the repository, producing a new 'initial commit'
Fancy Test 'Todo' in Kotlin & Junit5
Просмотров 3534 месяца назад
Implementing a custom '@Todo' annotation for Junit5 in Kotlin. - Use junit5 extensions - Modify test names for junit5 Sample code: github.com/sellmair/youtube/commit/4edb3122345a755040cab53f746f8e71b54e645c
Applied Gradle: One Test, Multiple Implementations
Просмотров 3235 месяцев назад
In this recording I will demonstrate how one could write one single test, which can be executed, using multiple underlying implementations. This can e.g. be useful when re-implementing one component, making sure that the new implementation matches the output of the old one perfectly
Gradle Intro: The Kotlin Gradle Plugin's model (TCS)
Просмотров 5585 месяцев назад
Basic introduction into the 'TCS' (Target, Compilation, Source Set) Model of the Kotlin Gradle Plugin.
Gradle Intro: Re-implementing the Kotlin Gradle Plugin from scratch
Просмотров 1,7 тыс.5 месяцев назад
Meeting Recording from '07.06.2024' at JetBrains (Team: 'Kotlin in Fleet'). This recording shows the basics and fundamentals of Gradle by re-implementing the Kotlin Gradle Plugin from scratch. This covers: - buildSrc - writing Gradle plugins - Tasks & configurations - Invoking the Kotlin Compiler - Running compiled .class files
Gradle Intro: Basics: Tasks & Configurations
Просмотров 2 тыс.5 месяцев назад
Meeting Recording from 29.05.24 in JetBrains (Team: 'Kotlin in Fleet'). In this recording, a basic Gradle introduction is provided. This will cover Gradle Tasks; Gradle Configurations and how different Gradle projects can depend on each other.
Is the source available?
Please tell me does it works for iOS platform Thanks 😁😁😁😁😁
Hohooo cant wait brooo
Nice work! 👍
That looks impressive! Great job! 😍
Feels smooth 😮
one viewModel per screen, one state in it(data class). initialize it as mutableState inside viewModel and callect as lifecycle state in screen. one sealed class for events(if event should be handled in screen like navigation). initialize it as channel and observe it inside launchedEffect(unit) other user events can directly call vm function. I mean it is pretty good.
Alerts ON , can't wait to use it 🔥🔥
This looks great.❤ I can't wait to use it! This will help a LOT in development, especially since we don't have previews in common code yet
This is awesome! 🚀
this is 🔥!
Thats awesome
thats supersonic
how do i do a super like. lol. this is so awesome.
Cant wait to use this!!
Damn that's blazing fast! Super excited for this!
Does this work even when code is changed in a gradle submodule dependency?
Yes!
Supports: adding functions, removing functions, changing function signatures, adding classes, removing classes. If bytecode inside the remember blocks change significantly, then this functions slot table gets invalidated
That hot reloading is actually super hot 🔥 I am wondering if something similar would theoretically be possible for server applications written with ktor or spring boot? 😮
Yes, it is possible. Though the best tool in this category, JRebel, is pretty pricey. But both Spring Boot and Ktor actually come with development mode that drops the class loader for the application module and reads the new class definitions into a new class loader. This approach works fine with a little tradeoff - it doesn't preserve the state.
it doesn't need to compile again when you deal with code that's not composable and works just like that without resetting any state??? HOLY FUCK THIS IS GOOD
I gotta admit, this is both explosive, and hot at the same time 😅 I love that it just does not even lose track of the existing mutableState objects, they stay the way they were. This is definitely powered by magic, you won't convince me otherwise.
@@GakisStylianos Thank you! And the cool part: I am planning to explain all of the magic in detail in the upcoming series! Edit: missed a word
@@s.sellmair I have already hit the bell button, I don't need more convincing😅
It was necessary to swap the webcam and the editor
Is Nothing in fact Everything?
@@tajapan To be or not to be, that's the question.
Amazing video! It’s so exciting to see coroutines from this perspective. I gained a much deeper understanding of how they work under the hood!.
I didn’t know the existence of the method measure and the extension. Thanks for that! Also, how do you make the suggestion saying “Tab to complete” ?
Fascinating and presented fast enough to drive home your point that one really needs to do this on their own for a full understanding. Thanks for uploading!
Hey seb, you should upload more such videos. These are awesome and easy to understand
6:50 why not just put mavenCentral() above google()?
This is some insane content!
Great Stuff
Great talk!
In your example you missed a point: by rotating the screen the Activity is recreated and the code in the onCreate event is executed again. The ViewModel init method is invoked once when the Activity is created, and the onClear method when the Activity is removed; when the device rotates the activity is re-created but the init method is not invoked and you can reuse the data stored in the view model (state) to populate the composable in the activity. The best approach is to have 1 single state in the ViewModel, the View (Compose) invokes the methods exposed by the ViewModel (i.e: doSave, doFilter, etc) and these methods update the state (each ViewModel has 1 state always containing the 'val onLoading: Boolean = false' and 'val failure: FailureXXX? = null' properties, besides all the properties needed by the UI). The state is monitored by the XXXScreen using LiveData or Flow, and the updated state is a property of the '@Composabe private fun XXXScreenContent(state: State) {}'): all the components used inside XXXScreenContent know nothing about the viewModel. Each event created by the components are sent back to the XXXScreen, that it will invoke the viewModel.doXXX. This is the architecture I have used since moved to Composable, and it works very well: everything is testable, the components are all stateless (very few are stateful), and you can create a company component library very quickly and be highly productive. P.S.: using lifecycleScope instead of viewModelScope can create problems, because you interrupt every process linked to it, forcing the restart of every background activity (and the use of the global scope is highly discouraged)
I've seen for these types of perf tests, you'll also get more accurate results if you warm up before you start measuring. If you don't do warm up, you'll generally see the first operations being slower than the last ones, skewing the results.
Whoops, should've watched a bit further before commenting...
Omfg, so detailed 😮
The flickering of the blur near your head vs background is really distracting. Maybe just disable it instead?
If you care about performance just use a serious language like Rust🚀
Why so serious? 🃏
By using 100,000 iterations you are diluting the Iterator instantiation overhead. Maybe a better test would be to execute a (0..10) loop 10,000 times.
Additionally: your benchmark measures almost empty for loops. In practice, your for loop typically does several times more work inside than is taken up by the actual iteration (branch prediction + misses). So whatever difference there is, it is going to get massively reduced in practice with actual usage.
Nice one. I would also recommend this talk from Aleksey Shipilev ruclips.net/video/x3Vlze1mUj4/видео.html , which explains this black hole and other black magic on JVM benchmarking.
I believe the benchmarks shown in the video are not entirely accurate. The key advantage of using fastForEach is that it avoids allocating a new iterator each time it's used. In the benchmark example, the performance difference may seem negligible because it's a simple case. However, when dealing with nested loops, the gap between the two approaches becomes more significant. For instance, if we need to loop through a matrix with a large number of rows (say, 1,000,000) allocating a new iterator for every row becomes a costly operation. In my case, the results are: - forEach: 462,983 us/op - fastForEach: 309,201 us/op As we can see, fastForEach is 1.5x faster than forEach. Here is the benchmark I used, by the way: @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MICROSECONDS) @Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) @Measurement(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS) @State(Scope.Benchmark) open class ForeachBenchmark { private lateinit var list: List<List<Int>> @Setup fun setup() { list = List(10_000) { List(10_000) { it } } } @Benchmark fun forEach(blackhole: Blackhole) { list.forEach { sublist -> sublist.forEach { element -> blackhole.consume(element) } } } @Benchmark fun fastForEach(blackhole: Blackhole) { for (i in list.indices) { val sublist = list[i] for (j in sublist.indices) { val element = sublist[j] blackhole.consume(element) } } } }
Recently made a PR which I named "This fixes Nothing". Couldn't stop myself haha
Awesome video! Gradle always felt scary and complicated, this definitely broke the ice for me. Thanks!
Awesome stuff, learn lots of new things.
Quality content!! 👌
Good vid bud
I thought that was because of the way Java allocates collection objects in memory, which is quite random if I am not mistaken. Without benchmarking, I believe you would be getting the same results if you try that in Java. Never tried it though, just a guess. In c++ I believe you won't have such problem, because of the different nature of arrays.
Also look at the bytecode
You are doing this youtube thing very nicely Sebastian 😆, catchy titles and good videos, good job mate
i liked how you addressed all the common questions one has when working with compose and viewmodels. you've got yourself a new subscriber