From 969507757c5d0119489726acd1e2e7de6f7c0209 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Mon, 14 Oct 2024 19:58:33 +0800 Subject: [PATCH] fixes vtable documentation in tut2 ref https://forum.nim-lang.org/t/12537#77311 --- doc/tut2.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/tut2.md b/doc/tut2.md index 1b59288d5ba6..c7f60abc377d 100644 --- a/doc/tut2.md +++ b/doc/tut2.md @@ -327,10 +327,12 @@ As the example demonstrates, invocation of a multi-method cannot be ambiguous: Collide 2 is preferred over collide 1 because the resolution works from left to right. Thus `Unit, Thing` is preferred over `Thing, Unit`. -**Performance note**: Nim does not produce a virtual method table, but -generates dispatch trees. This avoids the expensive indirect branch for method -calls and enables inlining. However, other optimizations like compile time -evaluation or dead code elimination do not work with methods. +**Performance note**: Nim generates dispatch trees for methods by default. +With `--experimental:vtables`, it also provides an option to generate +a virtual method table for methods, +which tends to produce better performance in general, +especially for deep object hierarchies. +However, other optimizations like compile time evaluation or dead code elimination do not work with methods. Exceptions