My Application loads a bunch of audio clips at startup. It uses java.applet.Applet.newAudioClip(URL audioFileURL)
to load the files, which are in the same folder. I could see that this function is basically a wrapper to get JavaSoundAudioClip
objects
Until yesterday, I compiled the JAR with JDK 7 and launched it with JRE version 7 update 45. Then I updated to version 8 update 31.
Now, the loading of each audio takes ten times longer than before (was 0.2 seconds each, now it is between 2 and 3 seconds)
The same behaviour happened on different hardware configurations. OS is 64bit Windows 7, both Java 7 and 8 runtime environments are 32bit.
Digging deeper in debugging, I found that the methods that slowed down the most are AudioSystem.getAudioInputStream
, AudioSystem.isLineSupported
, AudioSystem.getLine
Audio format shouldn't be involved: I tried both OGG and WAV with the same results.
The settings for both JVMs are the same
EDIT: even I couldn't reproduce the problem in a small program made ad-hoc. Java 8 is slower indeed, but only with a 10% factor. There must be something in particular with my application and the libraries I'm using that is conflicting with audio system and/or its streams. I will update as soon as I find out.
JDK13Services.getProviders(AudioFileReader.class); JDK13Services.getProviders(MixerProvider.class); JDK13Services.getProviders(AudioFileReader.class);