« first day (1798 days earlier)      last day (1681 days later) » 

7:31 AM
@FrenchBoiethios Corrected, I'm still waking up
 
8:24 AM
@Shepmaster the playground sends me bad gateway error on play.rust-lang.org/execute
 
That works well here
 
It's back
 
Tons of optimization questions today
 
what ? where ?
 
The dude trying to optimize syscalls for TCP
the other dude trying to optimize the use of uninitialized memory for a 4096b read
it's all micro-optimizations not backed by investigative data, though
Going to see if I can gently nudge the TCP guy out of doing what he's thinking of doing
if he implements it the wrong way it's going to hurt more than it helps
 
8:40 AM
@SébastienRenauld I hadn't seen this one
 
not backed by investigative data is the main point. That's bad to "optimize" without precise insights, no matter what
 
@SébastienRenauld I call this the 'systems programming syndrome' -- it is amazing when you give a specific tool to people they suddenly feel the urge to use it even if they shouldn't. There is that saying, that if you have a hammer in your hand you see nails everywhere.
(On a side note that's exactly the reason why guns should be banned..)
 
@PeterVaro I'd like to see investigative data, here
 
I hope I made the case clear on the IO/uninitialized memory part
like
sure
you're going to get a 30% perf boost using MaybeUninit
 
As there is no correlation between the number of guns / person vs gun crimes
 
8:43 AM
@FrenchBoiethios turn on your telly or read the news :)
 
but how small is that gain compared to the microsecond-level read time of most I/O media
Same goes for the TCP dude, he's trying to optimize at the OS level something that is already handled at the physical level by Nagle's algorithm
unless he is sending thousands of packets per second it's actually going to be a performance loss, as packets will arrive in one chunk at the eth phy
(Nagle's doesn't deal well with infrequent large bursts)
 
@PeterVaro Are you in the USA? That's not because people in the USA have a problem with guns that the whole word has. See: no correlation
 
Other countries have problems with other things, though
see: London and knife crime
it is not generalizable, but it is nevertheless an existing syndrome on a localized scale
 
@FrenchBoiethios nah, I'm currently UK based, London
 
@SébastienRenauld Well, crime is something definitely human :P
 
8:49 AM
Zoologists proved that animals also have a concept of what a crime is, haven't they?
or at least within a certain social contract
think they did it with magpies or ravens, can't remember
 
@FrenchBoiethios I forgot where I read an amazing article on how Australia fought against these violent crimes -- quite successfully
later on today I'll provide you a link, but right now I have to run for the weekly kick-off meeting
 
Imagine having kick-off meetings. I miss those
:-(
instead I'm going to have to argue, again, why rolling your own phy is not a good idea when there's a huge market using RS485
 
@PeterVaro I've just seen your personal site. It's pretty and ingenious, congrats
 
Well, I've the data: in USA, or UK, there is one crime/capita for 10 guns/capita, while in France (for example :P) there is one crime/capita for 70 guns/capita.
All is a matter of culture
Anglo-saxon countries do have a gun issue
 
There's a hidden variable in that
How many people who shouldn't have a gun end up with a gun
i.e. the failure rate of background checks
in France that's pretty much zero since guns are so incredibly hard to get legally
 
8:54 AM
@SébastienRenauld That's a totally right
 
in the US, depending on the state, it can get close to 100%
 
@SébastienRenauld Nope, that's very easy to have not a gun, but a bunch of guns in France.
 
Are you sure of that? My father tried for a while
 
Just go in a club, and then ask to buy one. If you didn't commit any crime, that's almost automatic
 
mostly because he was completely scared shitless from when he got carjacked 20 years prior
 
8:55 AM
Or go hunting
I come from the country side, everyone has a (or several) gun.
 
I'd be curious to see the statistics on gun count per capita in different backgrounds actually
 
@SébastienRenauld Maybe that's why he wasn't authorized
 
I'd expect city-based dwellers to not have any
Oh, yeah, totally, I'm not saying he should have had one
just saying that the checks are already much stricter than in most states
in places like TX you go to a gun show and come out with one, no questions asked (almost)
 
Fair point
 
I lived in DC for a while and the difference between DC and VA was night and day
DC is completely gun-free, i.e. you're not even allowed to bring them in (legally)
VA, on the other side, is lax and supports open carry
 
8:59 AM
@DenysSéguret why thank you! I still need to optimise it for mobile -- it's just not working at all.. but I'm slowly getting there..
 
I guess you had to use JS for "centering", right ?
 
You can center elements in pure CSS
Well, on modern browsers
some browsers require an extra "anchor" elements
 
@SébastienRenauld have you looked at the site?
 
You found something original. I cannot even write an even good looking site :D
 
I have
Holy shit son
handler CSS modification on every frame
my poor battery
 
9:01 AM
I implemented this version ~4-5 years ago
 
You can probably switch it really easily for that bit at least
 
I only updated the site generation a week or so ago but I have to rewrite a huge portion of this
 
take advantage of css transitions, they're standard now
this means you can just change left, top, width, height once a second
 
yup, I know, I work with 'em on a daily basis (unfortunately)
 
and the CSS animation will (optimally) do the rest for you
same goes, you don't need JS to center like that
anchor element gets position: absolute right: 50%;
 
9:03 AM
@SébastienRenauld with the two divs side to side ? Show me
 
@DenysSéguret that's what I wanted to ask
OVERLAPPED and masked, not even side by side
 
Hold on. We talking about the slider divs or the underlying?
because I'm talking about the content centering
if you're talking about the two divs for the color/sliding there is also a trick
 
Interestingly at the initial state everything is done by CSS
 
you make both divs 100% width and then you slide the entire container around
 
remove the JS and you'll see
 
9:04 AM
everything in this site is easy in pure css except the positioning of the two cropped texts
 
but once you want to interactively mask them
I can't think of a pure CSS solution
 
I can think of a way but it's horrible for SEO because it'll have duplicated text
 
TBH I think it's OK to have some JS for this
 
Oh, totally
@PeterVaro if I wanted to use the minimal amount of JS for this I'd dupe the text in two divs, one dark, one light
then use clip-path or mask
and then move that mask around to unhide
 
(I really have to pay attention to the meeting now.. but if you like, I could use your brain later on this -- in fact, I would appreciate any help on optimising it @SébastienRenauld!)
 
9:08 AM
my only big gripe with your website is you not using CSS transitions for the handle
the rest is micro-level
 
Last time I checked masks were a nightmare regarding performances and compatibility (I use them a little in Miaou but not much because of this)
 
and the point for the CSS transitions is to save battery on devices with one
Only if they move
 
CSS transitions, yes, use them when you can
 
The TCP dude comes back
goes "but is it possible"
Yes, it is possible, but it's dumb
 
Well, let it go. He has been warned, no need to try to convince him : he'll think about it later after having experimented
 
9:20 AM
Trying from another angle
since he's feeding his TCP pipe from futures::sync::mpsc::channel
i.e. his latency in this will be dominated by channel impl, not flushing/not flushing
 
9:33 AM
I'd say that a reference implements the Copy trait, while a String doesn't. The Copy trait is the real reason why there's no ownership transfer. — Denys Séguret 1 hour ago
That's the technically correct answer, but there is a semantic explanation to that.
 
@FrenchBoiethios There would be many parts to a real complete answer for people interested in a fine comprehension. But hopefully the Q has been closed
 
The duplicate applied
 
yes but my opinion was it was a little light on explaining why the reference doesn't exhibit the ownership problem
but nobody probably cares
 
the dude was brand new to rust; I doubt he'd go that far into subtleties right now
 
10:02 AM
@Stargateur 90% of the loss is in L3 access
if I had chosen a smaller buffer I'd have virtually no loss
 
I don't like your opinion in your answer
this is not a trivial optimization
 
In the case of the user it 100% is
remember, the original question is a 4096b buffer repeated read
the user would gain tenfold by growing their buffer, than they'd gain from using MaybeUninit, and that was my point
MaybeUninit is still a gain, but there are lower-hanging fruits
The entire benchmark and larger/repeated reads were added for completeness; that was not what the question is
Not just that, there are other factors at play. If the memory slab allocated is exactly a page memset will be optimized away, for example
And sure enough, setting the size of the buffer to a multiple of page size instead of 64000 chunks that 30% right off to 0
 
you assume too many thing
just keep it simple, is memory affect twice for nothing ? yes ? use maybeunit
 
How is "it is influenced by too many factors" assuming too much?
 
you should not advice code when it's depend of CPU
 
10:13 AM
the memset elision is a standard gcc/llvm optimization that (AFAIK) affects every modern arch
I know for sure that it affects armhf, x86, x86_64
 
That doesn't matter
just code good and let compiler do the optimization
but don't assume optimization
 
Yeah, about that
opt-level = 3 (i.e. release) while benchmarking puts the safe version (i.e. no MaybeUninit) over the other two
 
well, your code don't make sense
why use an array
than put data into a vec
no one will do that in real code
 
Just for you, I'll change it, but do try to remember how a [u8] -> Vec transformation is done and what the cost of it is.
 
@SébastienRenauld without following the Q/A (I have no idea what you are talking about) but by the sound of it, wouldn't an ArrayVec make more sense?
(btw, I'm back from the meeting -- sort of.. now I have to work :rolling_eyes:)
 
10:28 AM
@PeterVaro if you know the size of the final buffer
like, the Vec conversion @Stargateur is on about is a .map(|r| r.to_vec()) once there is already an underlying &[u8]
Not just that, as the buffer used to read into is held within the function returning a borrowed type isn't even possible anyway
In "real" code you'd keep that buffer outside to not have to reallocate it
and moving that outside of the benchmarking loop for this question would completely negate the purpose of the benchmark and the question all in one go
@PeterVaro just in case you want to follow
3
Q: In Rust, is there a way to directly read the content of a file into the given uninitialized byte array?

Seiichi UchidaI am looking for a way to directly read the content of a file into the provided uninitialized byte array. Currently, I have a code like the following: use std::fs::File; use std::mem::MaybeUninit; let buf: MaybeUninit<[u8; 4096]> = MaybeUninit::zeroed(); let f = File::open("some_file")?; f.rea...

 
@SébastienRenauld I appreciate it, but atm I really have no time for this :/ I wish I would though, sounds interesting enough..
 
It's honestly pedantry at this point; throwing the "real-world code" stone at the benchmark when real-world code would allocate this entire buffer (using MaybeUninit or otherwise) once (and would therefore net you a sub-microsecond performance gain, maybe, depending on buffer size choices) is literally just that.
 
 
2 hours later…
@FrenchBoiethios Gin And Tonic?
 
Hm
I half expected a shorthand method on ExitStatus to get the child return status
turns out there isn't one
 
1:19 PM
GATs. Say it loud and clear. Say it with pride.
6
 
1:37 PM
isn't that gesture like 3 years old already?
as in, open for that long
 
...Gesture? ... Open gesture?
 
feature
I'm in a taxi on the way to the airport
at the mercy of autocorrect
 
2:04 PM
@SébastienRenauld That's because putting it in the compiler is no piece of cake.
 
2:16 PM
But Chalk has already been finished, doesn't it?
 
@E_net4 Get All That shite ;)
 
@PeterVaro Grand Apple Trees suck
 
white about the s?
 
LOL
that last one is a new low, isn't it? :O
 
2:24 PM
Oy! The response to the new question could be a bit more friendly IMO
I don't think it's a bad question. Only because we know it doesn't make sense in Rust's context, doesn't mean it's a bad quesiton
 
@LukasKalbertodt gimme some concrete pointers to be friendlier
 
@LukasKalbertodt It is though -- zero effort put into finding it out
 
Who upvoted that stupid "check if a field is mutable at runtime" ???
 
@Shepmaster Your edit of "your question doesn't make sense in the context of Rust." is already better, I think. The first version sounded not so nice.
 
I stole the trailing words from you
 
2:28 PM
> You could try overloading the error handling, but that is an anti-pattern.
 
I mean, mh concrete pointers. But it's a confused newcomer to Rust... we should keep that in mind.
 
@Shepmaster \o
 
Should we really answer questions which don't make sense ? And change the question to try give it some meaning (answer about variables when the question is about fields) ?
 
the answer "it doesn't make sense" is sometimes a good one
 
2:32 PM
@DenysSéguret I disagree that the question itself doesn't make sense. It just doesn't make sense in the context of Rust. And that is something we can explain.
@SébastienRenauld Exactly
 
You answered a different question just to try pretend the question made some sense
 
@LukasKalbertodt Your answer is cool
 
side note, if anybody wants a good chuckle
 
@DenysSéguret I disagree. But you are right, I should clarify that his use of "fields" in the title is wrong.
 
Is it your company ? You should probably remove those comments then, now that we had our chuckle
 
2:35 PM
done
proof that marketing is okay until it comes down to ratings
@LukasKalbertodt that answer is pretty insightful actually
as in, not in the pearl of wisdom kind, but it clears out two issues in one go for somebody coming from a dynamic language (which, by the looks of his history, he is, sort of)
 
Edited my answer now with information on why "fields" is incorrect and on dynamic borrowing.
@SébastienRenauld Thanks
@Shepmaster Thanks for answering too and for responding to my critic. Sadly not something that is very common.
 
I wonder. is there a down-and-dirty in the rustonomicon or elsewhere of how references (mutable or otherwise) flow through to LLVM IR
as in, concept by concept on what actually happens when you define, borrow and use
 
@SébastienRenauld I'm not sure what you mean
 
Oh wow, "StackOverflow for Teams" actually got somewhat affordable. I contacted their sales team in 2017 and back then they said "Our pricing is on a per-user basis and we start at $100,000 USD with a minimum of 500 users". Quite different now!
 
I'm not entirely sure what I mean either, or at least not in super concrete terms. basically, a walk-through of sorts of how, say, a simple function or two highlighting how references are used get converted to an intermediate form with all the guarantees that the borrow checker and the entire chain enforce, at what stage, and how they impact the final (pre-optimization) output
 
2:43 PM
@SébastienRenauld perhaps some combination of: how does an integer address get dereferenced to a value?, What assumptions are made about immutable and mutable references and what is done with those assumptions?
 
it's personal curiosity as I don't think it'd help a beginner, but it's something I've been legitimately curious about ever since I started
@PeterHall that's be part of it, except the integer part
 
Once you are past the borrow checker, references are just integers.
and pre-optimisation, not much happens
 
@LukasKalbertodt Is it useful though ?
 
I'd have thought the interesting part would be about the optimisations
 
@DenysSéguret I can imagine it being useful in companies. But can't know for sure.
I'd love to use it for university courses. For huge ones especially. But yeah, universities do not have money for that :P
 
2:47 PM
I reckon huge companies would have a data compliance issue or two though
 
@SébastienRenauld Why?
Isn't it self-hosted?
 
The "enterprise" version is self hosted. So that would be fine I guess
 
Huge companies use Slack, and google analytics...
 
also, they're stepping very firmly on Atlassian territory on that
Not saying it's not worth it, but it might be difficult to justify
 
they are quite selective about when they care about these things
 
2:48 PM
That is very true
Side note, there's some really funky stuff happening on the node FFI question
it's all on the node side though
 
 
1 hour later…
3:57 PM
now I'm having doubts
how undefined is undefined behaviour to immediately drop a MaybeUninit into [u8] of a fixed size?
 
@SébastienRenauld *blinkblink*
Code?
 
5
A: In Rust, is there a way to directly read the content of a file into the given uninitialized byte array?

Sébastien RenauldSince you've ostensibly set your buffer to the size of one page (4kb), I've assumed you're doing small, random reads. For the large-reads version, read below. You are trying to micro-optimize something based on heuristics you think are the case, when they are not. The initialization of the arra...

for the context
I'll be back in an hour, taking the plane
I always thought dropping into an u8 was safe as there is no invariant issues, same with fixed size array, but now I'm having doubts
 
I believe invariance isn't the only problem though. Uninitialized memory doesn't work the same way as just garbage memory, even in trivially transmutable types. So I'd question the safety of that.
Have a pleasant flight!
 
@SébastienRenauld Nit: I think that calling MaybeUnint::unint().assume_init() is a straight undefined behavior. — Seiichi Uchida 42 mins ago
I'm pretty sure that the OP is right
 
4:32 PM
@SébastienRenauld this as not be decided yet
@FrenchBoiethios no really, this code is even in the doc of maybeunint
in this case it's depend do you consider it's ub to have no init u8
currently Rust didn't decide
but as I already say the code of Sébastien doesn't make sense right now
I think that for now it's considered UB
 
4:55 PM
if you're once again referring to the vector bit, I've already gone over this and the answer is the same - in a real codebase that alloc would not exist entirely
 
well, that one of the problem with your answer, in my opinion you are off topic
@SébastienRenauld Thanks for the detailed explanation with some cool benchmark results! It's my bad that I too simplified my example code, but my usage is not limited to reading a fixed size of region from the file. I basically need a mmap which does not suck :) — Seiichi Uchida 2 hours ago
 
with that precision, yes, but was that evident from the initial question?
again, the dude was doing a 4096b-sized read
 
i didn't tell it, my I was thinking that of your answer from the very beginning
 
now that I know what he really is doing, the way is clear for a better take at it, but again, how was that evident? dude puts in a MCVE of a 4096b read, gets an answer fitting the problem of a 4096b problem
 
I didn't talk about the mmap thing just
"In Rust, is there a way to directly read the content of a file into the given uninitialized byte array?"
 
5:01 PM
he could also have been doing random iops on a fragmented reader, and that would've also warranted a different answer, too. would it have been better to assume? doubt it
 
the answer is very short "yes"
 
The number of stars in this starred comment looks like it's the number of GATs. Let's add more GATs to the room. :>>>>
 
replace with "gay"s and it's more fun xd
 
@Stargateur look at the second half of the question and stop fixating on the first paragraph. the remaining half essentially boils down to "can you avoid the unnecessary initialization"
and for that, my answer of "yes but it doesn't gain you as much as you think it does" is less off-topic than you make it sound
 
well, first I still don't agree, secondly, your answer doesn't show a good example
 
5:04 PM
@Stargateur s/fun/inclusive/ ?
 
greetings from warsaw btw
 
@E_net4 gats... pride... gay pride ?
 
GAT pride
 
Let's do a GAT pride someday !
 
if I move the Vec outside of the benchmark the benchmark ends up benchmarking read performance, not alloc performance
 
5:05 PM
@SébastienRenauld well... yes, that exactly what the OP is asking
 
@Stargateur AKA Rust Hackathon for integrating GATs into the compiler.
 
@E_net4 we could finish with "when did you plan do guarantee recursive tail optimization ?"
 
half an hour to elaborate and fix that answer
@Stargateur added a description and pointer to read_to_end
along with the interrupt caveat & co
was tempted to also mention BufRead but the question specifically states that the buffer is provided from the outside, so that's a no-go
 
 
4 hours later…
8:50 PM
Woah, @LukasKalbertodt getting M A D.
 
Heh, I was going to comment on that too :)
laying down the LAW
 
I have the power to mark those comments as off-topic
but I don't really curate on GitHub
 
@Shepmaster Oh gosh, immediate attention from everyone :P
@Shepmaster If you do, be sure to also mark my comment as off-topic :P
 
do people randomly tag on to a github issue to ask something? :o
 
70 participants and no one knows how many people subscribed silently.
 
8:57 PM
@SébastienRenauld it started innocently enough: "here's how I do something while waiting for this feature to be implemented"
but then people started talking about that implementation instead.
 
I really would like to split tracking issue in actual "coordination" and "questions".
Did anyone have that idea before me? Was this discussed somewhere already?
 
@LukasKalbertodt do you think it would help?
I don't know of the idea, but it's easy enough to do, just say to ask on one of the fora
 
@Shepmaster Sometimes. Not only talking about this case. But I sometimes subscribe to tracking issues and only want to get actual updates and news about the feature. Not questions. (e.g. specialization can const generics)
 
pop over to discord, tell the idea to Centril. I get they feeling that they like putting themselves in the middle of that process.
 
But I also used tracking issues myself to ask questions about half baked features. Not like "pls explain" but rather "is this supposed to work this way?"
 
9:00 PM
other languages talk about one or the other off-issue-tracker
 
@Shepmaster I <3 Centril
 
PHP is notorious for that and it is having a total meltdown atm due to some of those off-issue issues
 
@SébastienRenauld I think it's just more of a graduated thing. Questions should be asked along a hierarchy, rising as needed. Just like Tier-1,2,3 support at a company
questions should be asked on the forums, but decisions originating from those sources should be tracked on the issue
a lot of times the questions are innocuous — "will this work for X case", "what will this look like for Y", etc.
 
absolutely agreed
it's a basic triage, effectively
 
@Shepmaster done
Any recommendation what Rustconf talks to watch?
 
9:23 PM
Oh boy this will be a fun one
Somebody didn't read a datasheet properly, I have a 500mW power supply for a device taking 800 while going at full speed on boot
task is to find a way to lower that in pure software, which I don't think is possible
 
Const generics feels very far from complete
 
@PeterHall Yip :/ bugs everywhere
Sadly varkor is apparently busy with life.
 
The RFC only talks about usize examples
I can declare a const type argument to be an enum. But it's an error to try to use it.
@LukasKalbertodt Yeah I saw
I wonder how long it would take to get up to speed enough to be productive on that
 
@PeterHall I don't want to demotivate anyone, but I tried a couple of times, but always failed basically. My contributions are for the most part standard library and not the actual compiler. It's hard :(
My brain doesn't understand the compiler :/
 
9:38 PM
@LukasKalbertodt That beats my one-liner docs contributions :)
 
10:04 PM
When you program a binary crate, do you use pub(crate) or do you just use pub instead?
Like, pub(crate) is "more correct", but its also verbose and one needs to write it a lot. And pub wouldn't make a difference for binary crates...
 
@LukasKalbertodt usually just pub
Most of my bin crates in my job are actually libs too
and then it matters more
Although the libs are mostly used for dev/testing purposes
 
Mhhhh ok
 

« first day (1798 days earlier)      last day (1681 days later) »