1 00:00:00,017 --> 00:00:04,757 It will be Kai over and yeah, Kai, the stage is yours. Thank you. 2 00:00:05,297 --> 00:00:10,317 Let me get the secret item I just stashed here. Anyone know what this is? 3 00:00:10,397 --> 00:00:12,657 It comes with this nice USB-Y cable. 4 00:00:13,997 --> 00:00:17,737 Yes. So you totally blew the cover. I even prepared a slide. 5 00:00:17,997 --> 00:00:20,117 Like, does this help? So yes. 6 00:00:20,517 --> 00:00:22,797 Yeah, that's like a coaster for your beer. 7 00:00:23,937 --> 00:00:25,177 So yeah, this is... 8 00:00:27,377 --> 00:00:32,277 Maybe. maybe um so yeah this is like an optical external drive so raise your 9 00:00:32,277 --> 00:00:39,117 hands who has used an optical drive or who still has an optical drive in their like daily computer. 10 00:00:40,897 --> 00:00:45,197 Yeah like you not the one that's sitting in the closet for 10 years but the 11 00:00:45,197 --> 00:00:49,697 one that you actually use does it still have an optical drive one hand so there's 12 00:00:49,697 --> 00:00:55,497 like two or three hands who Who has used it within the last two years or something? 13 00:00:56,817 --> 00:01:00,937 Oh my goodness, that's like totally different than I expected. 14 00:01:01,277 --> 00:01:06,477 But anyway, so this talk is about the story of how this device let me unlock 15 00:01:06,477 --> 00:01:10,597 a massive performance boost in our SOLID framework. 16 00:01:11,337 --> 00:01:18,857 SOLID is our multi-platform cross-platform device abstraction framework and 17 00:01:18,857 --> 00:01:22,197 it enumerates batteries and storage devices for the most part. 18 00:01:22,357 --> 00:01:26,697 It has backends for F-stop and U-disk and flip iMobile device even. 19 00:01:26,737 --> 00:01:28,017 So even if you plug in your iPhone, 20 00:01:28,157 --> 00:01:32,297 your battery monitor shows the battery percentage and that sort of thing. 21 00:01:32,437 --> 00:01:37,597 So it's very modular and cross-platform and it's used in a lot of places like 22 00:01:37,597 --> 00:01:41,737 device notifier where you see your external storage media, the battery monitor, 23 00:01:41,917 --> 00:01:45,257 the places panel in Dolphin where you have your bookmarks and the devices. 24 00:01:45,257 --> 00:01:51,137 For file previews, we check if the partition is encrypted and then don't store the cache and whatnot. 25 00:01:51,297 --> 00:01:56,477 So you probably, we can all agree that improving solid helps in a lot of places. 26 00:01:58,537 --> 00:02:04,417 So the UDISC's backend that talks to UDISC, which is this Linux service for 27 00:02:04,417 --> 00:02:05,737 enumerating storage devices. 28 00:02:08,411 --> 00:02:13,511 I found a couple of issues with it. So the UDISC backend enumerates all block 29 00:02:13,511 --> 00:02:15,591 devices of which there can be lots. 30 00:02:15,731 --> 00:02:20,231 For example, snap is very notorious for creating 500,000 loop device mounts. 31 00:02:20,431 --> 00:02:23,711 So I even have like special cases for like, okay, if this is a snap thing, 32 00:02:23,771 --> 00:02:25,411 then ignore it just to make it faster. 33 00:02:25,691 --> 00:02:30,631 And then for every device that it finds, it creates a device object and every 34 00:02:30,631 --> 00:02:35,351 device object then queries all of those properties from UDISCs and does it all 35 00:02:35,351 --> 00:02:37,571 with blocking synchronous DBUS cores. 36 00:02:37,571 --> 00:02:41,611 So it's not very efficient so the 37 00:02:41,611 --> 00:02:44,571 question is can we do better yes of course otherwise i 38 00:02:44,571 --> 00:02:48,311 wouldn't be giving this talk first of all don't never 39 00:02:48,311 --> 00:02:51,151 ever ever ever ever use qdbus interface 40 00:02:51,151 --> 00:02:54,731 it's this innocent looking class that 41 00:02:54,731 --> 00:02:57,771 in its constructor will do a blocking 42 00:02:57,771 --> 00:03:00,931 introspect call on the service so if 43 00:03:00,931 --> 00:03:03,791 you have one per device you can probably agree that it 44 00:03:03,791 --> 00:03:06,471 all adds up a lot and most of 45 00:03:06,471 --> 00:03:09,271 the time there isn't even a reason to do that because either you 46 00:03:09,271 --> 00:03:12,111 know the interface so you can use add dbus interface 47 00:03:12,111 --> 00:03:15,091 provide an xml description and have a compile time 48 00:03:15,091 --> 00:03:18,311 generated header file so no introspection needed or you 49 00:03:18,311 --> 00:03:22,991 do a blind call with like qdbus create method call you pass a string but there's 50 00:03:22,991 --> 00:03:28,131 never a reason to use qdbus interface so we probably should have a ci check 51 00:03:28,131 --> 00:03:31,971 that if you use qdbus interface it just blocks it and i will come knocking down 52 00:03:31,971 --> 00:03:35,771 your door so can we do better Of course, 53 00:03:35,831 --> 00:03:39,351 we can use DBus Object Manager in Solid. 54 00:03:39,571 --> 00:03:44,131 So Object Manager is this API which did not exist back when Solid was originally 55 00:03:44,131 --> 00:03:46,031 written. That's why it's not using it. 56 00:03:46,231 --> 00:03:49,151 And that lets us get all the properties at once. 57 00:03:49,651 --> 00:03:52,971 So I even have this merge request there. So if you want to give it a try, 58 00:03:53,031 --> 00:03:59,211 if you use weird, obscure media, then you can check out this merge request. 59 00:03:59,911 --> 00:04:05,491 So we use DBus Object Manager. We get all of the properties at once. Job done. 60 00:04:07,171 --> 00:04:12,291 Or is it? Optical media is scary, right? A USB stick, you plug it in, 61 00:04:12,331 --> 00:04:14,751 it comes up, you unplug it, goes away. 62 00:04:15,311 --> 00:04:19,031 Optical media, it's always this drive which has media in it. 63 00:04:19,131 --> 00:04:22,531 So we have to like monitor the drive and the media inside of it. 64 00:04:22,731 --> 00:04:27,171 And even the drive can go away. And then there's like audio CDs. So you plug it in. 65 00:04:27,311 --> 00:04:31,691 Solid says, oh, there's an audio CD, going to show it. You have data CD, CD comes. 66 00:04:31,891 --> 00:04:36,491 Solid is like, I don't know. then the file system appears and you have a data CD. 67 00:04:37,051 --> 00:04:40,791 And then there's mix mode Cs, you plug it in, Solid is like, oh, this is an audio CD. 68 00:04:41,111 --> 00:04:43,591 And then Udysseus is like, yeah, but it has a file system too. 69 00:04:43,731 --> 00:04:45,091 And then Solid is like, oh, it's here again. 70 00:04:45,251 --> 00:04:49,111 And then Places panel is like, I have two devices now, what's going on? 71 00:04:49,191 --> 00:04:51,251 And then it just explodes. So. 72 00:04:52,729 --> 00:04:57,729 The other month on Matrix I asked, like, anybody got a spare DVD drive? 73 00:04:57,809 --> 00:05:00,169 Because I don't have one. I haven't had one for, I don't know, 74 00:05:00,229 --> 00:05:02,389 15 years. One day my neighbor even knocked. 75 00:05:02,549 --> 00:05:06,929 So he's also in IT. He was like, I got some scans from my doctors. 76 00:05:06,989 --> 00:05:10,009 Like, do you have a CD drive? I was like, no, sorry. 77 00:05:10,189 --> 00:05:12,849 I asked half the neighborhood and I don't have a CD drive. 78 00:05:13,549 --> 00:05:19,409 So, yeah, I got this generous donation from Martin R. on the KD Neon channel, I think it was. 79 00:05:19,849 --> 00:05:22,629 And he said, yeah, you know, I have this lying around. you want to have 80 00:05:22,629 --> 00:05:25,309 it and was like yeah sure it's nice uh how much do 81 00:05:25,309 --> 00:05:28,049 you get for like postage and he was like ah it's fine i've 82 00:05:28,049 --> 00:05:30,769 always wanted to contribute to kd so he just sent it to 83 00:05:30,769 --> 00:05:33,569 me via mail for like six seven years or something and 84 00:05:33,569 --> 00:05:36,409 now i have this device and i suddenly could like reproduce 85 00:05:36,409 --> 00:05:39,969 all the weird issues that people had with my merch request because now 86 00:05:39,969 --> 00:05:43,129 i actually have this um device so yeah 87 00:05:43,129 --> 00:05:46,529 i can test all of those weird use cases now but before that 88 00:05:46,529 --> 00:05:49,649 i actually want to write lots of unit tests first for solid so 89 00:05:49,649 --> 00:05:52,949 if anyone knows if there's like a equivalent to umoc 90 00:05:52,949 --> 00:05:56,109 dev which lets you simulate u dev devices 91 00:05:56,109 --> 00:05:59,049 for udisk so i don't have to write a bunch 92 00:05:59,049 --> 00:06:03,289 of divas mock call that would be really nice because then i can actually test 93 00:06:03,289 --> 00:06:07,069 my change that automated before i actually merge because it's been ready for 94 00:06:07,069 --> 00:06:11,989 five or six years i've tried to do object manager port but always i said okay 95 00:06:11,989 --> 00:06:15,589 this optical drive stuff it's scary i don't want to merge it because it might 96 00:06:15,589 --> 00:06:16,909 like explode all over the place. 97 00:06:17,929 --> 00:06:21,429 So yeah, this goes to show that contributing is more than just code. 98 00:06:21,489 --> 00:06:24,729 We have people doing artwork, translations, promo work, IT infrastructure, 99 00:06:24,949 --> 00:06:30,109 people hosting calls and putting around microphones and much more. 100 00:06:30,189 --> 00:06:34,889 So yeah, it's not just about code, but like every little contribution counts. So thank you.