A common complaint I've seen in the Nim realtime chat is that the compile time for this project is long. I'll document some methods of reducing it.
- Repeat Dollar operator definitions, presently each
$ has it's own procedure and body, which means regardless if it's used or not it's semantically checked.
func `$`*(this: Thread): string {.inline.} =
var str : StringStream
this.output(str)
str.data
func `$`*(this: MutexDirect): string {.inline.} =
var str : StringStream
this.output(str)
str.data
...
Instead of the above one can do the following, which only causes a single semantic check, unless instantiation is made
type SimpleStringTypes = Thread or MutexDirect or ConditionVarDirect or ...
func `$`*(this: SimpleStringTypes): string {.inline.} =
var str : StringStream
this.output(str)
str.data
- Dont make swizzle procedures for every variation. This adds a ton of code which requires a ton of semantic checking, instead of making a procedure for each, we can just use an experimental
dotOperator . For reference
A common complaint I've seen in the Nim realtime chat is that the compile time for this project is long. I'll document some methods of reducing it.
$has it's own procedure and body, which means regardless if it's used or not it's semantically checked.Instead of the above one can do the following, which only causes a single semantic check, unless instantiation is made
dotOperator. For reference