Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

The following examples show how slow it is to load a simple GIF. Can anything be done to make it faster?

System #1: Mathematica 8.0.1.0, HP notebook, Win7 64Bit, 2 x 2.4Ghz Intel Core i5, 2GB RAM, w/ integrated Intel graphics chipset

AbsoluteTiming[Import["ExampleData/rose.gif"];]
(* 
  ==> {1.3650781, Null}
*)

System #2: Mathematica 8.0.1.0, MacBook Pro, OSX 10.7.2, 2.4GHz Intel Core i5, 8GB 1333 MHz DDR3 w/ integrated Intel HD graphics 3000 512MB

AbsoluteTiming[Import["ExampleData/rose.gif"];]
(* 
  ==> {2.549696, Null}
*)

Both installations are on local drives.

share|improve this question
    
It takes only 0.16 seconds or so (via AbsoluteTiming[]) on my installation (8.0.1 on Xubuntu Oneiric on a generic netbook with an Intel Atom processor); maybe you should mention your OS, Mathematica version, and possibly the specs of your computer? –  J. M. Feb 8 '12 at 13:19
1  
Is your Mathematica installed on a local drive or a network drive? File operations can sometimes be a lot slower on networks drives. –  Arnoud Buzing Feb 8 '12 at 13:37
3  
Please use AbsoluteTiming for benchmarking, Timing has surprises.... –  user21 Feb 8 '12 at 14:06
4  
Hmmm. I think this is the case where a great many people can say: "Look, I told you". The performance drop is solely the result of this modified built-in function. –  István Zachar Feb 8 '12 at 14:51
3  
I suggest to keep this question, in the following format: @Istvan makes his update as an answer. Then, we either close it or as mods to lock it. From that question on StringJoin, we provide a link to here, as a very good case. Because, overloading system functions is an appealing idea to many people, and nothing serves better as a good stand-alone example, like this one. No amount of warnings would be better, since those warnings warn against "theoretical" threats. –  Leonid Shifrin Feb 8 '12 at 15:42
show 6 more comments

closed as too localized by J. M., rm -rf, David, István Zachar, Szabolcs Feb 8 '12 at 16:32

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 6 down vote accepted

The cause of the slow speed is the presence of a modified System` function: StringJoin. As this modified StringJoin operates at suboptimal speed (see Leonid's answer and comments here), there is a performance drop of 1-2 magnitudes. So I did learn the hard way why is it a bad idea to modify built-in symbols.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.