« first day (3555 days earlier)      last day (1376 days later) » 

4:22 AM
So my conspiracy to become a research professor seems to have hit a snag, apparently the department can't issue me the title despite having funds. They said it may take more than a year to get approval for the position. I might need to get a real job :-(
 
4:58 AM
"Dear US Government, thank you for giving me the money but my department doesn't want the money. Additionally I have recently learned that an entry level position doing React Native pays twice as much as developing an instrument that was recently shown to improve fertility rates by 30%. "
 
 
3 hours later…
user7659542
7:57 AM
@Mikhail don't worry the higher pay in the industry will improve your bang rate by 30% too
 
user7659542
8:46 AM
Most of the time when people use malloc, they want the data to be initialized to 0
 
user7659542
Why don't all those people not just use calloc?
 
user7659542
 
9:24 AM
8
A: Is there there any reason NOT to use calloc instead of malloc?

Sourav GhoshThis is really a situation-dependent decision. Rule of thumb is If you're first writing into the allocated memory, malloc() is better (less possible overhead). Example: Consider the following scenario char * pointer = NULL; //allocation strcpy(pointer, source); here, allocation can be ver...

 
10:23 AM
I am not doing something right, every time I am running this piece of code on Arduino, my robot tries to run away from me.
 
nwp
Let it free you monster.
 
10:53 AM
"Don't leave me, dear robot claw car, I will write better code to make you stay"
 
nwp
đź‘Ť
 
@traducerad because they plan to immediately write into the data and writing into the data twice will slow their code down by a factor of two?
Also, in principle malloc won't cause page faults, which means it can go faster or leave the OS time to deal with pages...
So for example, consider this case (from one of my projects), if you calloc ~200 GB it takes forever and often fails (because Linux sucks), but if you malloc it will be filled slower and fails much less often.
Now in my case I needed to fill this large buffer to avoid page faults, so I fill it with dummy data, which should be what calloc does :-)
Reminds me of how much easier it is to deal with hundreds of gigabytes of RAM on Windows compared to Linux.
 
 
2 hours later…
1:12 PM
@Mikhail wut... that makes no sense... does linux not have a good kernel level zeroing mechanism? With Mach and Ntkernel it's just a matter of requesting zero'd pages. calloc can actually be massively faster that malloc+memset because the latter triggers faults and maps the pages into residency.
 
 
1 hour later…
user1804599
2:14 PM
@Mikhail The question was about people who want it zeroed, yet use malloc instead of calloc.
 
user1804599
@traducerad You should enable optimizations if you want to compare assembly code.
 
user1804599
2:31 PM
And once you do that, you see that the compiler will indeed turn malloc+fill into calloc. godbolt.org/z/3naWzh
 
user1804599
So it doesn’t matter shit. Reason you may want to use malloc in all cases is because you put it behind an abstraction, and then use it from there, possibly from generalized situation with a template. For instance, std::vector with a custom allocator.
 
user1804599
If you write high-performance code you always do this with inlining and strength reduction in mind.
 
5:09 PM
 
user1804599
No, it’s just a series of if statements recognizing specific patterns. So actually yes, just like AI.
 
user1804599
Fun fact: your application uses machine learning. Because that’s what the branch predictor does.
 
Do modern CPUs have more sophisticated branch predictors than "probably gonna be the same as last time"?
 
user1804599
So I bought this assortment of chili peppers and it has a Carolina reaper in it, and I’m not quite sure how to use it.
 
Damn, I wanted to point out that branch predictor trivia
@rightfold let it simmer in soup or dahl, or make your own chilli sauce with it
 
user1804599
5:12 PM
Carolina reaper looks all shriveled up, as if it ate one itself.
 
Probably easier to make it simmer in something then
 
Do the Carolina Reaper challenge!
 
user1804599
I was at an Indian restaurant once and I got a dish that had some really nice vegetables and rice and sauce, with a single chili pepper on top.
 
user1804599
I ruined the experience by eating the pepper first, whole.
 
user1804599
I cried and couldn’t taste anything anymore after.
 
5:14 PM
rightfold is too precious to lose her to such a challenge
 
user1804599
 
5:31 PM
Mild spiciness is best.
@fredoverflow is that a rhetorical question? (I'd think you know the answer.)
 
user1804599
This is neat, Google calculator can calculate with units.
 
user1804599
 
user1804599
I wish DuckDuckGo could do that. WolframAlpha is super slow.
 
5:46 PM
Matt's explanation of global branch history on x86 CPUs (2014) is quite cool: youtube.com/watch?v=hgcNM-6wr34&t=18m32s
It's amazing the ideas the CPU designers come up with.
 
@rightfold Are you sure that's not just a melted wax pepper?
 
6:32 PM
I propose a new programming language (possibly esoteric),
it is called C Flat (or C--), because no one else seems to have come up with the name (which is definitely not the only thing I've planned for the language)
 
user1804599
C-- already exists. A large portion of the GHC runtime system is written in it.
 
Ooh, that's new. What of Câ™­ (C Flat)?
@rightfold Seems like a mix between Assembly and C... Reminds me of other endeavors like HLA (High-Level Assembler)
 
user1804599
They need precise control over some of the registers and guaranteed tail call optimization.
 
6:52 PM
Another random proposal to add base 32 literals in high-level programming languages.
In the form of `0x...`
 
user1804599
Just add a template to the standard library like base<8, "755">.
 
user1804599
Anyone ever used Sage?
 
user1804599
It seems to be able to convert expressions into C functions which is nice.
 
user1804599
Currently using Wolfram Cloud but it’s slow, proprietary and requires an Internet connection.
 
user1804599
7:51 PM
sage: from sympy.utilities.codegen import codegen
sage: var('R L C f')
(R, L, C, f)
sage: func = solve(f == sqrt(1 / (L * C) - (R / L)^2) / (2 * pi), R)[1]
sage: print(codegen(("R", func), language="F95")[0][1])
subroutine R(C, L, f, R)
implicit none
REAL*8, intent(in) :: C
REAL*8, intent(in) :: L
REAL*8, intent(in) :: f
REAL*8, intent(out) :: R
REAL*8, parameter :: pi = 3.1415926535897932d0
R = sqrt(-4*pi**2*L**2*f**2 + L/C)
end subroutine
 
user1804599
This is pretty neat.
 
user1804599
8:44 PM
As expected my experience with this Python-based software has been awful so far.
 
10:04 PM
 

« first day (3555 days earlier)      last day (1376 days later) »