Skip to content

Reduce compile time #3

Description

@beef331

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.

  1. 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
  1. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions