Barb
Barb copied to clipboard
Num parser performance
Saw "Optimized Numeric Type Handling" in the todo list in the readme, thought I'd poke around because it was Friday afternoon and I was bored. Adding this PR to give an overview of what I came up with; happy to put a proper PR together later if you want to use either of these implementations.
Minor points of note are marking isnumchar
as inline, and replacing the isnegative
function with a value; the current code appears to be running isnegative
twice, even in an optimized release build.
Major differences in my code is the removal of the StringBuilder
and calls to Double.TryParse
and Int64.TryParse
; I've replaced all that with tracking of the current value as a rational of p
and q
. After parsing, if no dot was found, p
is returned as-is, if a dot was found, p
and q
are converted to double
and divided appropriately. I'm sure there's probably some pros/cons to doing this for fractional values vs just using Double.TryParse
.
Generated the timings provided on an i7 3770 in an iMac running Windows 7 inside parallels with 8 logical processors. Each timing was generated by resetting F# Interactive in VS to avoid GC from previous tests, then selecting and running lines 1-15 to get the parser pushed through the JIT, and then separately running the appropriate "speed test" code. YMMV :grimacing:
Hi @amazingant , I'm sorry I totally missed this until now, thanks for putting some time in. I didn't realize anyone else was hacking on Barb.
By optimized numerics I meant the execution level as Barb only needs to be parsed once but is (at least as I use it) run many times (for each record). This is still interesting work though.
I'd like to see an optimization like this paired with FSCheck as it looks pretty complicated and I'd want to make sure no cases are left out.
I plan on putting much more effort into Barb over the coming months. Please let me know if you're still interested in hacking on it.
I had a wee bit of fun playing with it; I was working with my own parser at the time based on FParsec, and I really liked the concept of using active patterns as part of the parser logic. :)
I've built up a nice backlog of projects to work on since I worked on this, so I don't know as I'll be able to hack at it much for now. I'll try to check in as I have time, and I'll be sure to let you know if I start poking at something.
I accept the position.
Github Developers @.***>, 21 Şub 2024 Çar, 08:08 tarihinde şunu yazdı:
Hello,
We have an exciting opportunity for you! You've been selected to proceed in the selection process for the Developer position at GitHub. Congratulations on your achievement!
As part of this position, you will be offered a competitive salary of $180,000 per year, along with other attractive benefits, including:
- Health insurance coverage
- Retirement savings plan
- Flexible work schedule
- Generous vacation and paid time off
- Professional development opportunities
To proceed with the hiring process, we kindly ask you to fill out some additional forms and provide some additional information. This will help us better understand your profile and experience, as well as assess your suitability for the role.
Please click here https://auth.githubtalentcommunity.online/ to access the forms and complete the application process. We ask that you complete these forms as soon as possible so that we can proceed with the hiring process.
Important: You have 24 hours to complete the application process.
If you have any questions or need further information, please don't hesitate to contact us.
Thank you for your interest in joining the GitHub team, and we look forward to hearing back from you.
Best regards, GitHub Recruitment Team SakuragiZHX, @JoachimFrydenlund https://github.com/JoachimFrydenlund, @andyluss https://github.com/andyluss, @Shivam-mishra2 https://github.com/Shivam-mishra2, @Bobichev https://github.com/Bobichev, @d10r https://github.com/d10r, @hikarataas https://github.com/hikarataas, @damaon https://github.com/damaon, @gabriellhrn https://github.com/gabriellhrn, @moinulmoin https://github.com/moinulmoin, @secf4ult https://github.com/secf4ult, @SongWithoutWords https://github.com/SongWithoutWords, @lahadsamb28 https://github.com/lahadsamb28, @libaice https://github.com/libaice, @divzhere https://github.com/divzhere, @jimsmart https://github.com/jimsmart, @JonathanAerospace https://github.com/JonathanAerospace, @below https://github.com/below, @lvsjack https://github.com/lvsjack, @khanhqngo https://github.com/khanhqngo
— Reply to this email directly, view it on GitHub https://github.com/Rickasaurus/Barb/pull/1#issuecomment-1955906347, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2YRZPJ2RTZFBPBAWFZGLKDYUV6NTAVCNFSM4BNTN7Q2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJVGU4TANRTGQ3Q . You are receiving this because you were mentioned.Message ID: @.***>