Apache Cordova
  1. Apache Cordova
  2. CB-390

File IO Encoding and Performance iOS

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.5.0
    • Fix Version/s: None
    • Component/s: iOS
    • Labels:
      None

      Description

      The performance of the Apache Callback / Cordova file IO operations on iOS is causing problems (memory exceptions for large files). The encoding should be removed, as it is not required and there also is double (triple) buffer allocation. NSString has a read method, so why isn't that just used?

        Activity

        Hide
        Becky Gibson added a comment -

        There is no method on the FileWriter to support an encoding so UTF is always used in order to support non-ascii data.

        The reason for not using the NSString writeToFile method (which now requires the specification of an encoding) is that it doesn't allow for appending - it overwrites any existing file at that path. We could possibly use stringWithContentsOfFile: usedEncoding: error to read the file but I don't think that will affect the performance. I'm open to modifying the code to be more efficient but changing from using NSOutputStream to using NSString methods would require more involved error checking for file existence and more work to append to an existing file.

        Show
        Becky Gibson added a comment - There is no method on the FileWriter to support an encoding so UTF is always used in order to support non-ascii data. The reason for not using the NSString writeToFile method (which now requires the specification of an encoding) is that it doesn't allow for appending - it overwrites any existing file at that path. We could possibly use stringWithContentsOfFile: usedEncoding: error to read the file but I don't think that will affect the performance. I'm open to modifying the code to be more efficient but changing from using NSOutputStream to using NSString methods would require more involved error checking for file existence and more work to append to an existing file.

          People

          • Assignee:
            Unassigned
            Reporter:
            Lee Crossley
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development