https://github.com/msink/kotlin-blink
Kotlin/Native blink sample
https://github.com/msink/kotlin-blink
Last synced: 3 months ago
JSON representation
Kotlin/Native blink sample
- Host: GitHub
- URL: https://github.com/msink/kotlin-blink
- Owner: msink
- Created: 2017-08-17T12:33:35.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-18T05:42:06.000Z (almost 8 years ago)
- Last Synced: 2025-01-17T18:57:11.254Z (5 months ago)
- Language: Kotlin
- Size: 725 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
_Kotlin/Native_ code size measurement
=====================================## C
```c
#include
#include#define BLINK_LED 0
int main(int argc, char *argv[])
{
gpio_request(BLINK_LED, "blink-led");
gpio_direction_output(BLINK_LED, 1);
for (;;) {
mdelay(200);
gpio_set_value(BLINK_LED, 0);
mdelay(200);
gpio_set_value(BLINK_LED, 1);
}
}
```compiled code size: (0x401609 - 0x4015B0) = 89 bytes
## Kotlin
```kotlin
import lib.*const val BLINK_LED = 0
fun main(args: Array) {
gpio_request(BLINK_LED, "blink-led");
gpio_direction_output(BLINK_LED, 1);
while (true) {
mdelay(200);
gpio_set_value(BLINK_LED, 0);
mdelay(200);
gpio_set_value(BLINK_LED, 1);
}
}
```
compiled code size: (0x4351D9 - 0x434E60) + (0x401693 - 0x401620) = 1004 bytes## Result
Kotlin code is (1004 / 89) = 11.3 times bigger.
Order of magnitude.