emscripten-core / emscripten-core/emscripten

Using Freetype in my project leads to extremely long startup times and excessive memory consumption.

Open
#17,190 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Attached is a [very simple application](https://github.com/emscripten-core/emscripten/files/8872711/project.zip) that is using the library that I'm working on. All that project is doing is starting the Emscripten-generated build. I'm experiencing a huge increase in startup times and excessive memory consumption with NodeJS versions < `v18`, when I enable a flag `-DHAVE_FREETYPE` (this enables several freetype-related features in the underlying project) during compilation (`opencascade.js@2.0.0-beta.af1af03` comes with freetype support, `opencascade.js@2.0.0-beta.ae74abe` comes without freetype support).

Here are a few benchmarks:

```
NodeJS: v16
Freetype enabled: yes (2.0.0-beta.af1af03)
Startup Time: Just over 30 min
Memory Consumption: ~60 GB
```

```
NodeJS: v18
Freetype enabled: yes (2.0.0-beta.af1af03)
Startup Time: ~15s
Memory Consumption: 1.4 GB
```

```
NodeJS: v16
Freetype enabled: no (2.0.0-beta.ae74abe)
Startup Time: 28s
Memory Consumption: 3.4 GB
```

```
NodeJS: v18
Freetype enabled: no (2.0.0-beta.ae74abe)
Startup Time: 15s
Memory Consumption: 1.4 GB
```

On AWS and GCP, the most recent Node version available for cloud functions is currently v16, therefore it would be great if that environment would be supported....

**Version of emscripten/emsdk:**
3.1.12

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.