juce::File windows optim


#1

Hi Guys,

Wouldn’t it be faster in juce::File on Windows to actually store the WideCharPointer instead of the Juce::String for fullPath ?

It seems there is a conversion each time it is used.

my 2 cents !


#2

It only gets converted to a WCHAR on Windows, and it only happens when it’s needed for to pass into an OS function, at which point the OS call that follows is likely to take hundreds of times longer than doing the string conversion. The vast majority of method calls on File will be string manipulations, so being a String is the best format.

…so I’m surprised you’re asking this! It seems to me like it’d be a really bad de-optimisation rather than anything that’d be of benefit… What made you suggest this?


#3

Saw that in the profiler and it seemed superfluous.


#4

For it to even appear in the optimiser you must have been doing an awful lot of OS file calls… I’m a bit surprised that it’d use enough time to show up, TBH.


#5

Probably because you don’t do apps that load 50000 samples :slight_smile: