The type check level is specified both at the command line and in a Jungle file. The Jungle file specification will be ignored

in the announcement of 4.1.6 in https://forums.garmin.com/developer/connect-iq/b/news-announcements/posts/connect-iq-4-1-6-sdk-release I see some things in the changelog that I can't find any information about. For example:

  • Add support for setting ‘project.typecheck’ and ‘project.optimization’ properties in a Jungle file.

What should the values be? I tried to guess them from https://forums.garmin.com/developer/connect-iq/b/news-announcements/posts/optimal-monkey-c but it doesn't seem to have any effect:

project.typecheck = 2
project.optimization = 2

but when I click Run this is the command I see in the terminal:

java -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar /home/gavriel/Garmin/ConnectIQ/Sdks/connectiq-sdk-lin-4.1.6-2022-11-04-17f8cfdf3/bin/monkeybrains.jar -o bin/MyApp.prg -f /home/gavriel/Garmin/MyApp/monkey.jungle;/home/gavriel/Garmin/MyApp/barrels.jungle -y /home/gavriel/Garmin/developer_key.der -d fenix6_sim -w -l 3

WARNING: The type check level is specified both at the command line and in a Jungle file. The Jungle file specification will be ignored.


And why the setting in the plugin settings override the setting in the jungle file?
  • I've not tried this myself but with the 1.0.7 extension there is this in the extension settings.  Maybe try changing it?

  • yes I had to change that to Default, that way the warning disappeared. Unfortunately there's no indication whatsoever after that how it's building. I compared it with: project.optimization set to 0, 1 and 2 (and not including it at all), here are the results:

    Default is 1
    in my app the total size of code+data+entrypoint were like this:
    0: 21439
    1: 21409
    2: 19643

    So in my case using the default only removes 30 bytes (from what "would be"* with the previous non optimizing compiler) so it's worth to set it to 2 either in the jungle file or by adding -O2 in the plugin settings, because only that gives a real decrease in size.

    *) I have not compare now the code size with 4.1.5, so I'm not sure, but that's not the point now, but rather than -O2 is much better

  • Ok, I took one of my apps I've not changed for type checking, and with "default", type checking really complained.  So then in that project's monkey.jungle, I added this

    project.typecheck = 0

    project.optimization = 2
    No type checking messages (and it did save me memory with the optomizatiom)
    I wouldn't expect to see this on the compiler command line, as it's getting this from the jungle file.
  • what is the difference between 2=fast and 3=slow optimizations?

  • from https://forums.garmin.com/developer/connect-iq/b/news-announcements/posts/optimal-monkey-c

    Currently, level range from 0 (no optimizations) to 2 (release). Level 2 should bring the most code space reduction. 

    but I think that's dated right now

    I expect the difference could be related to optomizing for size, speed, or both. I'm looking arround the doc, but I don't see anything

  • I don't think there's 3 for optimization, only for typecheck

  • Currently level is 1-3

    usage: monkeyc [-a <arg>] [-b <arg>] [-c <arg>] [-d <arg>] [--debug-log-level
           <arg>] [--debug-log-output <arg>] [-e] [--Eno-invalid-symbol] [-f <arg>]
           [-g] [-h] [-i <arg>] [-k] [-l <arg>] [-m <arg>] [-o <arg>] [-O <arg>] [-p
           <arg>] [-r] [-s <arg>] [-t] [-u <arg>] [-v] [-w] [-x <arg>] [-y <arg>]
           [-z <arg>]

    -O,--optimization <arg>    Optimization level [0=none, 1=basic, 2=fast
                               optimizations, 3=slow optimizations] [p=optimize
                               performance, z=optimize code space]

    -l0 -O3, -l0 -O2, -O3p and -O3z all produce the same in memory viewer