Skip to content
Snippets Groups Projects
  • Colin Walters's avatar
    597f03b4
    dirfd: Use better and faster random algorithm for gen_temp_name() · 597f03b4
    Colin Walters authored
    I was looking at ostree performance, and a surprising amount of
    time was spent in `glnx_gen_temp_name()`.  We end up calling it
    from the main loop, and the iteration here shows up in my perf
    profiles.
    
    The glibc algorithm here that we adopted is *very* dated; let's
    switch to use `GRand`, which gives us a better algorithm.
    
    It'd be even better of course to use `getrandom()`, but we should do that in
    glib at some point.
    
    While I had the patient open, I extended the charset with lowercase, to better
    avoid collisions.
    597f03b4
    History
    dirfd: Use better and faster random algorithm for gen_temp_name()
    Colin Walters authored
    I was looking at ostree performance, and a surprising amount of
    time was spent in `glnx_gen_temp_name()`.  We end up calling it
    from the main loop, and the iteration here shows up in my perf
    profiles.
    
    The glibc algorithm here that we adopted is *very* dated; let's
    switch to use `GRand`, which gives us a better algorithm.
    
    It'd be even better of course to use `getrandom()`, but we should do that in
    glib at some point.
    
    While I had the patient open, I extended the charset with lowercase, to better
    avoid collisions.