Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load contents of source files only when needed #559

Merged
merged 4 commits into from
Jan 17, 2020

Commits on Jan 16, 2020

  1. [skip changelog] Pass path and contents separately to SketchSaveItemCpp

    Previously, these two arguments were wrapped together in a sketch.Item,
    but since all callers build such an item during the call, there is no
    compelling reason to do it like this. This commit splits the Item
    parameter into a separate path and contents, which prepares for removing
    the file contents from sketch.Item later.
    matthijskooijman committed Jan 16, 2020
    Configuration menu
    Copy the full SHA
    1499123 View commit details
    Browse the repository at this point in the history
  2. [skip changelog] Let SketchMergeSources return error

    This adds an error return value, which is currently always nil. This
    prepares for making changes that require returning errors.
    matthijskooijman committed Jan 16, 2020
    Configuration menu
    Copy the full SHA
    7b31ac3 View commit details
    Browse the repository at this point in the history
  3. [skip changelog] Let sketch.Item.GetSourceStr return error

    This adds an error return value to this method, which is currently
    always nil. This prepares for actually returning errors later.
    matthijskooijman committed Jan 16, 2020
    Configuration menu
    Copy the full SHA
    4d48dc5 View commit details
    Browse the repository at this point in the history
  4. Load sketch file contents only when needed

    Previously, the full contents of *all* sketch files would be loaded into
    memory. This includes all source and header files inside the sketch
    directory, even when they will not even be compiled (e.g.
    subdirectories other than src). In practice, only the .ino file contents
    will actually be used, so these are now read on demand.
    
    Note that when copying the sketch into the build directory, the contents
    of all these sketch files *is* used, but that code (`writeIfDifferent()`
    in `arduino/builder/sketch.go`) already did not use the preloaded data
    but read the file contents when copying.
    
    For small sketches, this does not make much of a difference, but bigger
    sketches, especially when they include libraries, core definitions,
    tools, examples, documentation, etc. the memory usage can quite explode,
    for no good reason.
    matthijskooijman committed Jan 16, 2020
    Configuration menu
    Copy the full SHA
    903247d View commit details
    Browse the repository at this point in the history