-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trying to avoid expensive `UUID.randomUUID()` unless we reallly need it. Closes #8716. # Important Notes Some improvement: ![Screenshot from 2024-01-11 15-16-10](https://github.com/enso-org/enso/assets/292128/d8800490-6676-4b71-b178-7ce2e79942e5) FWIW Total Time for a Hello World example Before ![Screenshot from 2024-01-12 17-45-56](https://github.com/enso-org/enso/assets/292128/c0bfe7c5-c0a5-4375-8dd9-afb0714ae6c4) After ![Screenshot from 2024-01-12 17-46-13](https://github.com/enso-org/enso/assets/292128/ea76c413-018f-4b67-9777-85378eb38210) Memory usage Before ![Screenshot from 2024-01-12 17-54-54](https://github.com/enso-org/enso/assets/292128/280b1eff-e019-4241-a2a1-07445949d285) After ![Screenshot from 2024-01-12 17-54-36](https://github.com/enso-org/enso/assets/292128/b6524c8b-2a38-4e51-85eb-63142420f2ff)
- Loading branch information
Showing
38 changed files
with
356 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
engine/runtime-parser/src/main/scala/org/enso/compiler/core/ir/LazyId.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.enso.compiler.core.ir | ||
|
||
import org.enso.compiler.core.IR.randomId | ||
import org.enso.compiler.core.{IR, Identifier} | ||
|
||
import java.util.UUID | ||
|
||
trait LazyId { self: IR => | ||
private[this] var _id: UUID @Identifier = null | ||
|
||
protected def id: UUID @Identifier = { | ||
_id | ||
} | ||
|
||
override def getId(): UUID @Identifier = { | ||
if (_id == null) { | ||
_id = randomId() | ||
} | ||
_id | ||
} | ||
|
||
def id_=(id: UUID @Identifier) = { | ||
assert(_id == null) | ||
_id = id | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.