A Python developer with no Rust experience achieved a JSON parser that outperforms CPython's C-backed standard library within six weeks by combining structured curriculum learning with deep exploration of performance optimization techniques including SIMD, streaming parsers, and copy-on-write strategies, demonstrating that deliberate practice and understanding low-level computer architecture can enable developers to surpass established benchmarks even when starting from a beginner mindset.
深度探索
先修知识
- 暂无数据。
后续步骤
- 暂无数据。
深度探索
A Python Developer Built a Rust JSON Parser That Beats CPython's Standard Library in 6 Weeks本站添加:
Josh, what's your biggest win takeaway, realization from the cohort?
My realization, um sort of about myself and the learning in Rust or or the result. Um The I think from a high-level the real the takeaway was do as many of these with you guys as I can cuz I I think the particular environment you have set up. And I of course I experienced it five years ago with you, Bob. Um alone, but it's a wonderfully um supportive and I felt like exhilarating, at least for me, um way of learning this stuff. Um Big picture is a it really really especially if you're um and if you're a developer working all day in an IDE like VS Code and you know cloud code or code exists part of your day-to-day, >> [clears throat] >> um it can become it's almost like we're managing something. I'm not a person, but we're we're more managers than writing code ourselves all day long. Um I needed to This takeaway was take the time to learn a a different language. Um I mean Rust is a great Rust is actually the perfect one to to pick. Um And for for various reasons we can talk about, but it's just the experience of like going into it with a with, you know, feeling like you're an expert in one language. That's a I mean the expert mindset can be a problem for development in elsewhere in your life or professional life included, I think.
I kind of thought I was going in with a beginner mindset into the Rust course and then I week two and a half I was like, "Oh, no, I'm not. I I am I have I'm I have such expectations and of the language and myself I've got to like calm down." And so it was uh I guess from a learning and growth point of view it was um massively rewarding. Um that's that's the big picture, you know.
Yeah. It's Yeah, especially today, you know, writing the code, struggling with concepts like borrow checking and ownership that were completely new was it was just it was hard and it was you know, it was frustrating.
But it was one of those things I um I don't I would probably pull out an analogy like running. I don't like running, but I've never regretted a run and I've I've you know, done long runs or something. So, it was it was just rewarding personally and I think it's just really important to do.
I'm going on and on, sorry.
It's it's it's really important especially now when so much code is being generated by agents to to do this.
Yeah. I think that that makes it even more needed these days, right? Like so easy for AI to write the code that when you have that deliberate practice back as as it used to be um, that's yeah.
It's like it's like doping. I mean, in a way it's like a performance enhancing drug, right?
If you if you if you if you're really good at a particular kind of language already, it's like oh my god, I'm 10x myself.
And then you can start to think that is me like a substitution thinking happens. It's like you can feel I've seen it happen. I've seen other people do it. I've seen my I felt it myself. Like real pride around thing you created in 3 days which is like 10,000.
I'm like hold on a second.
Okay. I prompted. I was good at that part. How much of this did I write? Do I understand it all? It's just a really easy sort of path to to go down and it makes you lazy complacent.
Yeah, my experience.
Nice. So, hard work rewarding and how many hours more or less per week did you spend to get it done [clears throat] with good quality?
Um Yeah.
>> Minus your final polish, of course.
Yeah, I'm leaving out the performance stuff which we'll get to soon. The final polish was like yeah, that was um that was that was a lot. It was you know, many many hours. Um you know, I you you guys at the beginning the first cohort you said like you sort of gave us a sense of the pacing and it seemed the pacing like one module per week for six weeks to me it was like oh that's no problem.
And you kind of suggested the first cohort that kind of around week three or four things started to get jammed up and like I'm like that won't happen. It did happen.
So it it took I think it took At first I'm like ah 12 hours will be fine. I Just just to be completely transparent honest um I was doing I don't know 20 hours.
Oh wow. Not evenly spread across the week. I mean it was sometimes it was like 12 hours in one day.
Um so it went up. It definitely went up.
10 to 20 and then on average like including the first few weeks?
Probably week weeks one through five 10 to 10 to 20 maybe. Okay. Yeah. I should have I should have I should have actually tracked my time.
So yeah.
You took it seriously. Yeah.
Well, I don't know if you want to I could go on. One thing that that happened to me sort of like a week two and a half or three or Um was I the whole as you learn I was learning these new concepts and I would be like oh I think I got that and then we'd all ask questions and then Jim would have his great feedback in the code reviews. And there [clears throat] was this little part of my head part of my like back of my head was like these little words like are you sure? Um and so the I'm not necessarily saying to do this cohort really well to create a a JSON parser you need to do what I did. I just I just um I felt like I felt like an impostor. You know, this impostor syndrome like I don't know this stuff. Why am I pretending I do? I'll probably It was It wasn't It was like a not a too much of a negative voice but it was more like just really make sure you know what this is.
And so I I kind of started to go deeper and deeper and deeper. And with Rust I mean, you start you start to talk about you know, um, living you know, bits and bytes around and I how much memory uh, UTF versus an ASCII character takes up.
That's the I mean, you have to get to that level where you're really in it to I think to to fully I mean, not that I'm an expert, but like to internalize the the important parts and so um, yeah, that was a learning process.
>> That makes sense. And because of those kinds of concepts, in some ways there's almost no bottom to Rust, too.
[laughter] Yeah. Yeah.
There's a next level, right? Yeah. Yeah.
I learned so many other things about uh, pro- computer science programming during this course, like SIMD I think I never knew about, so Mhm. That's cool. Yeah. I mean, I can I'll just get let you keep going through your questions, otherwise I'll take us down a rabbit >> Would that extra learning be one of the most valuable parts, you think? Uh, because obviously you learned a lot of Rust, um, but you say you have all that that side learning and and know how computers work better, as well, right? Is that one of the most valuable parts? Um, Yeah.
otherwise.
I would say it was what I think the other learning I did, for example, I guess we'll get to this, but you sort of one of your questions was how did you approach optimizing your parser? How did you get it to to be fast? Um, I I didn't I basically said, well, you guys have structured the course so well, it would we we all know what JSON is. We all we've all done we've parsed we've all parsed nested JSON in Python, all that. So, it was a real really discrete and well-defined goal. Um, but I didn't I mean, I figured it was some combination of time and space, like big O notation was was in there somewhere, like in terms of like performance, but I didn't know what made JSON parsers fast, so I just sort of like I did a I did I did a research, like I would ask Claude, like generally speaking in programming, what what makes what things contribute to make JSON parsers fast? And they would give me these like a list of stuff, and I didn't know how to understand how to do it. It's like SIMD, which um is one of those stands for single instruction multiple data, right? It's kind of a computer architecture. And SIMD JSON was the one I I was targeting to beat later.
It's It's really It's a very It's an architectural pattern that has to do with processing and um and instructions to the processor. And I was like, I had I had no idea I had no idea what that was. Um so, that sort of thing I think it had something to do with the Pentium, if I remember my uh CPU architecture history right.
Yeah, I mean, you you guys You have a Right, you have you have a CS degree, right? Um unlike somebody who doesn't know.
Yeah, CS and electrical engineer. Yeah, yeah. Yeah.
That's why I know some hardware stuff.
Yeah, it was useful and I Yeah, I'll stop there.
Yeah. So, so you seem pretty confident now if you would tackle a new Rust project, right? But to put a number to it on a scale from say 0 to 10, what what is your confidence level if you start a Rust project today after doing this cohort?
Um it depends on the project is, but if it's like um Right. I don't want Yeah.
I don't I already Intermediate average type project. Yeah. Oh, oh my my try. My try. I mean, oh probably not.
I think after like you know, the optimizations and stuff that's successful that I I think my confidence on this probably ridiculously high. Um uh like you know, eight, nine. Um But that could that could change real quick cuz I I know there's huge in terms of the vast swaths of Rust I don't fully have my head around. Um yeah, it's very high.
Before Before I knew anything it was probably also high.
I was blindly naive.
But you're a good learner though. That was very clear watching you go through the cohort. You know how to learn and go deep. So, that was a That was a joy to watch. And then you went farther. I mean, I was learning from uh what you were digging out of the uh Rust documentation. Some things I was like, "I've never seen that before.
That's pretty cool."
Oh, that's Thank you. Thank you. Yeah, I have I do have references for all the places I found um things uh like lifetime validating references of lifetime etc. That's useful. Um well, that's thank you very much. Um I mean, you you made it uh you made it really easy. You You did You have like a way of um You're very patient. You're very calm. I think uh your feedback and your code reviews, I mean, I have a couple here. Like this is the week two. It's It was just It's um "Looking really great, Josh. You're making great progress. Very evident this week." This is week two and I'm like running I'm like like I don't I barely know what I have no idea what I'm doing.
Um and your the encouragement you have so you have what's working well and then are areas for improvement. Um this the that kind of language and naming is very is very very nice. It It just essentially and what's working well is like four four four bullet points with lovely explanation and then what areas for There's five areas for improvement, but you don't go into detail right there. So, the first impression as somebody having no clue what they're doing um from the instructors it's like, "Oh, okay."
Um I can I I Yeah, I don't I don't totally suck. Okay. So, it was just like a Okay, more motivation. It's really helpful cuz um Glad to hear that. I really am.
I'm I'm glad you noticed that, too. My uh choice of words there for those uh headings were very intentionally chosen.
But because I know I I have empathy though for like how Rust or languages like this can beat you down and like it's I I I could have done tongue and cheek headers like uh Oh, you think you're good and then ways you suck or something like that. Yeah, it was like oh, wow, it's okay. Didn't see that coming, Jim. You seem so nice.
Yeah.
I mean, the first I mean, I've taken CS courses college and after. First CS course I took, it was it's a whole conversation around how how computer science is taught and and it's probably changing now, but mistaught. I mean, this is the most intimidating thing I've ever been in. It was like Turbo Pascal, I'm dating myself. And it was just it was just presented as like you get right into it with no explanation of what anything means and it was just like Yeah. we punched in the face and then being stepped on. It was just terrible, metaphorically. But so I really really appreciate that teaching style. Um I'm glad you rocked it, yeah.
That's That was a pet peeve of mine going through technical university majors. I I can't imagine, yeah. Above I can see why you you you guys partner cuz Bob Mhm. Bob has that approach to it. It's just makes all the difference, yeah.
I'm glad you appreciate that. Thank you for the feedback.
Oh, of course it's true, yes. Very much appreciate your your feedback. Um Nice.
So though I mean part of that that going the extra mile is kind of a Josh attribute, right?
But what what sparked that that final sprint on the performance because there are some performance optimization in the curriculum, right? There are clear tips like don't overly clone and stuff, but you you took it to the next I know you're very curious and and want to learn, but was there also something you mentioned also James reviews that feedback, right? But but what sparked it because you really really went far with that. Oh, thank you.
Yeah, that I wouldn't that wouldn't have happened without you guys, by the way.
You laid the foundation, I think.
Um I think I remember uh You caught some bug. It was Like Not just a little bug. You caught the big bug.
The because we didn't mention it in the question actually, but you you it's it's on the landing page now, but you managed to make your parser faster than the C standard library one, which after 6 weeks of hard work is is pretty amazing.
>> [laughter] >> At least by that, you know, for full disclosure information.
>> Yeah, thank you. You know, if people want the details, I let's see. And you documented it extensively in a wiki wiki. Yeah. Yeah. Yeah. I want well I I figured if I didn't do that, no one believed me.
Also, documenting like you don't know something until you write about it and I'm like I'm like I'm not everything's fat. Like the writing of the wiki itself forced me to really get, you know, make sure my language was correct and understand things at a different level. So it was it was useful. Yeah. So I guess the takeaway my my parser beat CPython's standard library system in the readme.
JSON and every fixture in the suite including all three real real world files that are the canonical inputs every JSON library used. So yeah, and the fixtures were small, medium, large, extra large, deeply nested, and some other ones that are used by other real world data sources. But a couple of things This is this is important because I think I mean important for me to understand it. I think also anyone going into the cohort or trying to um It looks like when you look at my readme now, it's like, "Oh my god." It's like it looks like a snapshot of of you know, something really great. Getting there was a was a path and I certainly didn't think it was going to be the outcome when I started.
Jim, going back to Jim's comments, um One you made you gave me permission at some point to go off of the beaten path or outside the curriculum in one of your um one of your responses. thing. Uh I could tell you were starting to eat it up. You were ready for it.
Uh yeah. Um you made you made some nice thing. I was trying to bring some like software pattern stuff to it where I could and you you recognize that. Thank you. Um Sorry, where is it? You also didn't You didn't mind my inline comments.
Um Okay, so yeah, so fluent use of uh you you gave me credit for um a chain you call it idiomatic common creator style approach that goes beyond what the lesson demonstrates. It was just some comment in week um three.
And I feel like that gave me permission to like um could could be creative uh and so And also you you define the the goal.
Like we I really like well-defined products with with with well-defined metrics that we care about as performance, right? It was um speed essentially. Um So, once I had once I got to the end when I did my benchmarking and it at this is like an example of how naive I am.
When we did the benchmarking and it didn't beat uh C you know, Python C-based um standard library JSON I was like I was I was surprised. I'm like, "What? Why didn't it?" Cuz I was like assuming again So, a lot of this is me like checking my expectations and my like um ego a little bit. It's like, "I'm assuming it would beat it." It's like, "Well, we're doing it in Rust. It's like magic." Um And then like I I like, "Oh, it didn't Why Why didn't it?" And then I was like, "Okay, calm down. First of all, the goal of this course wasn't to beat um you know, Python standard library Sorry.
It was just to get yours to a to a place where it worked and you can make it you know, you and then you get to a a place like a sort of baseline and then can you get better from there? Like, "Okay, so calm down. Of course you didn't beat Python after 6 weeks."
>> Exactly. I was going to say, "At least raw Python."
Yeah.
Um That would always be an accomplishment not to uh beat that though. I would like to see that Rust code.
The To Which one? Sorry.
If you didn't beat to the uh just the pure uh I think it the module is simplejson that has no C optimization behind it.
Yeah. The slow Rust >> that much down to not beat that, that would be an accomplishment.
Right. [laughter] Right. Clone everything and no or or it's all all the bad things. Um So then it then I got it and I I can take you guys through a little bit um if it's useful how how I cuz the deep dive was in the last in the last 2 weeks 5 6 I kind of I just went all in and and many more hours. Um because I became obsessed with like I I've the work I've done the work I do now in Python around genetic workflows and I guess what I started out my career there's some there's some part of me like um I kind of if I have a clear goal and I'm you know I have a sense of like this is the important thing Josh, if you need to break rules or not ask permission just go do it. Um I don't know why. It's like a kind of like a I don't know if that's a good trait or bad trait, I don't know. Um but I'm like I'm just going to I'm going to freaking I'm going to figure out what it's going to take and I'm going to beat it. I'm not cuz I I'm like now now it's game time. And so I um I just looked It was an exploration and a deep exploration into Rust but I was led there by by by sort of under trying to understand what made JSON parsers faster. Um and a couple of things you you know have a list like this in you. This is at sort of abstract at a high level in general for languages.
Memory access patterns, um if you stream inputs sequentially, um these ones that jump around, SIMD which is um if few of what escape handling, UTF-8 um, validations, a whole bunch of things that I I couldn't do, like um, branch prediction, um, memory bandwidth as a ceiling, so list of stuff that that in general helps you get faster, um, string handling, zero copy, fast paths, number parsing, fast paths, API shape.
Um, so I'm like, "Okay, what is what what is SIMD?" I'm like, "No, I like yeah I don't know." I'm like, "Okay, where does that Is that in Rust somewhere?" I I don't know. I'll pick up the book or I would look through the You guys need to show you guys do it in by the way.
It was amazing.
Um, it was it I mean it was it was it was so well done. You clearly put effort into that and and it's it's it really for the Pythonista coming into Rust, we're like, "What what is happening?"
Um, it's a nice gentle sort of like cuz there are I mean there are things that are completely new. I think the real innovation of Rust that doesn't really exist elsewhere, like like ownership and um, borrow checking, that's truly innovative. Like that's really a Rust thing. Um, there are and uh, that's this is like if you say you're trying to Python there's no correlate for it. Um, but your your materials do like there are things that are similar, right? We have um, you know, vectors, we have lists which are, you know, vec T, we have um, dictionaries which are hash maps, um, there are things that are we have we have string, we have one one string type in the small pipe in Rust, but there are things that you guys could could hook sort of connect to that made it less abrupt and um, sort of a jumping into cold water.
Yeah.
I I tried to keep the course set tight for what only what you needed, right?
Like leave tool analogy, like your toolbox, leave the rest of those tools in the toolbox for now. Yeah. Yeah.
Um, yeah, I think the thing the thing I where I was like I was glad I had permission or sort of Uh, at least >> [clears throat] >> it seemed like I was going to have permission was I when I created a streaming parser that wasn't in the curriculum and that was like making a file so I don't even supposed to be here.
Um, and I think that of the optimizations in the various ones that I listed in the in the wiki um the streaming parser to me felt really meaningful. Um and so I think and in looking at that I had to learn certain concepts like the the A lifetime parameter um which is really really kind of fascinating thing.
Um but my so my my week five parser had like two stages each scanning the whole input um which meant that like every token string is a heap allocation. Um it's a lot of strings built um so and then it would throw the whole pre-built tokens off of back and system that we the the wiki.
>> [snorts] >> The new one um dispatches on the raw next bytes. So like I didn't like even know okay wiki and we're at the byte level um I I know there's libraries standard libraries in Python that deal with bytes obviously um um you I've used them a couple times to to really create byte objects out of um uh out of files for what I'm doing on rags sort of thing or trying to identify a fingerprint but not like this. This is um really just uh a recursive descent that had very different allocation profile and I think for me like the the life stuff I didn't know about before 71 of the things um also cow copy on um right which is amazing and I know it's not only in rust um but that felt to me like the kernel of uh of the performance improvement and then the things sort of fell around it if that makes sense.
相关推荐
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
Re: 🗣️📍theprophedu📍2026 GST 103 CLASS (E-EXAM REVISION)
theprophedu
636 views•2026-06-04
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Instagram accounts got PWNed
EricParker
13K views•2026-06-03











