> Also, because Android is based on the Apache Harmony stack, any > library improvements contributed upstream will benefit both projects. > > Also, is there a particular use case you're targeting? (Random reads > across binary files is pretty abstract, and there might be system > tools to help speed things up for special cases, such as > BitmapFactory.)
My application is what I consider to be a pretty common use case. I have a large data file, which is too large to hold within the Android's limited memory. (For this test it was 2.8MB, but it could just as easily be 50MB, which probably qualifies as "large" from a G1's standpoint.) I need to make a single very fast scan of the file to build an index, and then to be able to rapidly read any single record within the file based upon that index. The latter is, of course, straightforward if I can count on batch operations to be moderately efficient for some variety of random access. Memory mapping has always been my preferred technique, but this benchmark shows that I'd be sacrificing a great deal of performance. Luckily, it appears that FileChannels will do the job reasonably well. For the pre-scan pass, I'd again prefer to use memory mapping, since it avoids boundary detection issues involved with buffered I/O. Since I can't afford 36 seconds for a file scan, however, I'm left once again resorting to FileChannels as a clumsy but reliable alternative. It sounds as if I should harken to everyone's advice and start contributing wholesale patches to improve the performance of the more traditional I/O functions -- a single character read shouldn't be blindingly fast, but it can certainly do better than allocating a one- byte array and then doing a batch read. I'm used to the more heavy- weight world of Sun's JDKs where one doesn't really expect patches to be well received. (I'd still imagine quite a large lag time between contributing an efficiency improvement and having it deployed "in the wild" where my software would benefit from it. However, making the world a better place is it's own reward.) -Robert [email protected] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

