« first day (2323 days earlier)      last day (1386 days later) » 

00:38
FYI @DenysSéguret @Shepmaster @Jason Comparing AHash to other hashing algorithms (since we talked about xxHash earlier)
 
5 hours later…
06:05
@PeterVaro Thanks
 
1 hour later…
07:17
@PeterVaro Cool! Are you intending on using it?
07:46
I'll test it myself in the next few days, I think. I have a few programs where hashing might make a difference
08:20
Morn'
08:48
@Jason Maybe, but ATM I have nothing to use it for, I just read the above article last night, 'twas on HN and I thought you guys might be interested to know about it as well.
09:01
I didn't see it on HN
I just tried it on broot. I have too much disk speed variation to be sure there's a difference
I'll try it on the Lapin asap
@DenysSéguret I think I read it there, maybe I did not. I use RSS, so it is harder to remember where I read something, as everything looks the same (which is brilliant, except for helping one remembering the source)..
09:20
Morning!
@PeterVaro Yes, thanks for sharing it! Interested in those results @DenysSéguret
@Jason o\
 
1 hour later…
10:37
Someone once (not in this chat) mentioned to me that iterating over a string with .bytes() instead of .chars() is better as it doesn't allocate on the heap, with the big if being here that you're only dealing with ASCII.
Q: I'm not seeing where it does allocate in this way. Does it? From what I can see .chars() iterates over u8 and calls .next() with next_code_point(), advancing the iterator until the next code point in validations.rs
Am I missing something?
@Jason what ? bytes is just faster but not unicode
doesn't allocate anything in theory
@Stargateur I know, I tend to use .bytes() where possible, but this reasoning from someone else is stuck in my head, i.e. ".chars() is slower due to heap allocation" and I'm not seeing where it does?
@Jason Please don't. Really.
I will indeed not advice to use bytes in any context
10:52
bytes is faster in a way that it doesn't have to "parse" the bytes to chars (i.e. finding the end of a "wide character"). But chars won't allocate anything, it just uses a "wasteful" char instead of a u8 which is smaller if the returned character is ASCII only
unicode "parsing" is very fast. It's hard to have the changes you make by using bytes instead of chars pay off in term of performances. I know it because I often try it
if you need perf don't use string period
@DenysSéguret Ah, cool, I still have this JavaScript mindset at times of things being very performance sensitive.
@Stargateur I would amend this advice: if you don't care about the boundaries of characters (ever!), just the underlying data alone as a whole or as bytes (but always as a whole) then using any continuous u8 data could be faster in theory.
You rarely don't care about character boundaries...
10:57
^^^ My point exactly.
@PeterVaro if your system need perf, you should not use string, string is for user input output
Right, I keep forgetting that it is pointless to argue with you @Stargateur :upside_down_smile:
@Stargateur outputting is with chars too (and more). And searching is often mixed
@PeterVaro well, I kind of tired of thing like HTTP 1, where people don't understand why they should not use string
@Stargateur But that is a niche of a niche. So in general, not a good advice, especially not in the context of Jason's question.
But that's it, 'nough said, I really don't wish to argue about this.
11:00
Yes, all I can see is that it's bit manipulating it into a `u32` that is then interpreted as `char`, I was wondering whether I misunderstood how something might be allocated on the heap.

So:
- It doesn't allocate on the heap
- It's unlikely to ever be a performance problem, and worse, might be the cause of bugs.
@Jason Yes. Do you understand how unicode works? I might have a very good video recommendation for you, if you haven't watched that already -- a good introduction to get familiar with the whys and hows.
^^^ @Jason
@PeterVaro Ah, yes, I have also seen that video, but thank you for sharing! :p
:thumbs_up:
"é".length === 2
"é".length === 1
11:04
@Jason === -> == you mean ;)
Fuck JavaScript.
2
JavaScript!
Haha
I prefer ==, yes. I do not like the idea of type coercion, it is awful in my opinion.
@Jason That's one of the many reasons you have to deal with chars when searching: you need to normalize one way or another one
(in broot I list both strings as search results when the user typed one of them)
@DenysSéguret That makes sense, especially with user input.
11:44
I'd need a better bench suite to see the difference between ahash and fnv. That doesn't mean it's small but I have a natural variation of about 30% in my applications from one run to the following one so I can't see one of a few %
Ahash does seem to be almost consistently slower, though
11:57
But I mainly use small keys in my rust applications. I don't have presently a good test case. Ahash seems to make sense only with big keys
12:33
I struggle with some basics- co-sort two vectors of numbers (u32 in my case). (?) Any hints/hooks how I can achive this?
zip and sort the tuples ?
Can you prepare a playground thingie so that we see your data and the exact problem ?
that is afwul- sorry i will correct it
@user3184950 a and b are mutable does something need to happen to them?
(I'm too lazy to remove a vec allocation but it's possible, if perfs are super critical)
thx! - I am not sure if mut is needed, but I thoughed maybe they can be sorted inplace with some one liner
They can be sorted in place, I think. I don't have the one-liner in head right now
I had a loop, to give you a idea how ugly this was before
12:56
If perfs matter, maybe have a look at docs.rs/permutation/0.2.5/permutation
I saw that one, but I am very conservative with adding crates... Maybe I need to change that
And performance doesn't matter at all - it is part of a calculation that is probably taking months..
You can look at the code you import, then freeze the version. It's not very different from coding it yourself then.
If perfs don't matter, the zip-unzip code has an important advantage: it's very explicit and readable
Indeeeeed!
Yeah- but really the difference is now I have code I don't understand fully and need to learn a bit about it.
Oh, nice, Itertools now seems to have sorted_unstable
yet another thing to bench
13:08
@DenysSéguret Haha
hashing speed could matter a lot in rhit but I'll have to dive into itertools to see if I can change the hasher
 
1 hour later…
14:17
-1
Q: Rust String to type cast

k0lt1raI want to modify pull of objects (bevy_ecs) in runtime. For example command get Player will search for all 'Player' structs in ECS and print it out (or change, doesn't matter). The problem is how to cast String to a type/struct (at least struct without generics) dynamically. Here you can find exa...

please close that
@Stargateur I noticed that one, but I do not understand what is being asked.
"Cast String to a type …", which makes me wonder "What type?"
> how to cast String to a type/struct (at least struct without generics) dynamically
Rust might be the wrong language for them
I think pull of objects refers to Bevy's pool of objects.
I had to follow the link, but it appears that Python has a function that does some kind of eval.
Ugh
It's obvious OP is on an horribly wrong path to doom, but how to put that in a tactful and helpful way ?
(no @Stargateur, don't answer that)
14:28
@DenysSéguret "stop trying coding in rust go to python"
Oy, who the heck are we if we're telling people to do Python.
2
@Stargateur I was more on the track of hintting at the possibilities of rust, like enums maybe
@E_net4flagseverything I still think lang like rust are not for everyone
It's not up to us to question what language they should be working with. FWIW, our efforts still go towards improving the repository of questions and answers about Rust, thus empowering more people to use it.
Judge the question, not the user.
@E_net4flagseverything the question is garbage
I don't care of the user ^^'
14:38
@Stargateur And yet there is an upvote. :[
@E_net4flagseverything I guess it's the one who answer it
I don't get people still asking other devs to rally to star Rust to give the langage "visibility and credibility"... reddit.com/r/rust/comments/lpjoty/…
Play childish rating games doesn't make the language credible
That one's new to me. Are people oblivious of the real value Rust has already brought to the world?
14:59
@DenysSéguret "It is similar to C++" this trigger me so hard
@Stargateur Ah, similar to youtu.be/BxV14h0kFs0
@Jason totally
> Related Topics "c-plus-plus", "language"
I wouldn't know. I haven't written a line of C++, I thought it somewhat was? Or part of the same domain at least?
Are the structures of the "heapless" crate interesting performance wise ?
@DenysSéguret I think it's the opposite
15:24
I mean in specific cases, like dealing with arrays you know will never be more than 8 items
it's quite hard to answer on a general case, if this is a long term array, use the heap will be faster cause there is more protection on the stack than on the heap, but a static array should be as fast but only a static one, but here again it's OS specific
@DenysSéguret I think I might have seen that crate being used, but in an embedded context? If you find out that there's a difference in performance I'd be interested in hearing more about it.
@DenysSéguret why not arrayvec for that?
I would keep it simple if possible
@Shepmaster you're right. I was thinking about this specific heapless crate but it's true there are already solutions for this case
@Stargateur There are too many parenthesis, and they're not balanced. Is that the joke ?
15:40
@DenysSéguret yes, it's a joke :p, it's mean regex are more scary than nuclear war for dev :p
I love regexes. But not this one, she's broken.
i don't know if it's on purpose or not :p
15:57
10
Q: Is there a difference between [formal-semantics] and [language-lawyer]?

trentclCurrently formal-semantics seems to be about 20% questions about the rigorous mathematical sense of semantics, and 80% questions about a specific language where the asker is concerned with correctly interpreting the language specification or reference. I'm tempted to manually retag the second cat...

trentcl representing
 
1 hour later…
17:40
@Stargateur This is cool, the camera reminds me of this other embedded project
 
5 hours later…
22:22
I'm trying to write a plugin in Rust for a C application. I need to set a global flag every X milliseconds. In C I'd use timer_create with SIGEV_THREAD or similar; is there something similar for Rust? Asking because the examples I've found searching do not seem similar at all. One uses an event loop, which I don't have, and another is future/promise based, and I don't know how I'd ever await something (it's supposed to be fully asynchronous).
I guess spawning a thread and sleeping for X milliseconds then setting the flag would approximate it, but that's going to be less precise than timer_create (not sure if that's a problem, probably not).
22:38
I guess I could run an event loop in another thread.

« first day (2323 days earlier)      last day (1386 days later) »