• S sverchok
  • Информация о проекте
    • Информация о проекте
    • Активность
    • Метки
    • Участники
  • Репозиторий
    • Репозиторий
    • Файлы
    • Коммиты
    • Ветки
    • Теги
    • Участники
    • Диаграмма
    • Сравнение
  • Задачи 148
    • Задачи 148
    • Список
    • Доски
    • Спринты
  • Запросы на слияние 21
    • Запросы на слияние 21
  • CI/CD
    • CI/CD
    • Конвейеры
    • Задания
    • Расписания
  • Развертывания
    • Развертывания
    • Окружения
    • Релизы
  • Пакеты и реестры
    • Пакеты и реестры
    • Реестр пакетов
    • Реестр контейнеров
  • Мониторинг
    • Мониторинг
    • Инциденты
  • Аналитика
    • Аналитика
    • Поток ценности
    • CI/CD
    • Репозиторий
  • Wiki
    • Wiki
  • Сниппеты
    • Сниппеты
  • Активность
  • Диаграмма
  • Создать новую задачу
  • Задания
  • Коммиты
  • Доски с задачами
Свернуть панель
  • nikitronn
  • sverchok
  • Задачи
  • #1990
Закр.
Открыто
Задача созд. Дек 30, 2017 пользователемnikitronn@nikitronnВладелец

Performance considerations (discussion)

Created by: portnov

While trying to improve performance of "bend along surface" node, I did some research about about whether it worth it to move some part of code to C++ (you can see the code at https://github.com/portnov/python_cpp_excersises). Here are the results:

  • It is not so hard to integrate C++ and python nowadays. Keyword is "boost::python".
  • It is possible to eliminate data copying almost completely in most situations.
  • The most subtle thing is memory management. Python has it's own memory management, C++ has it's own "kind-of memory management". You must know at each moment who owns the particular pointer, who is gonna release it and when exactly.
  • For non-numeric code (such as "get data and put it to the map of some sort", "traverse that map" and so on), C++ code is about 3-4 times faster than very similar python code.
  • For vectorized numeric computations in C++, the keywords are "boost::ublas" and "eigen" (last one uses SIMD instructions when they are available).
  • For numeric code, C++ can be about 10 times faster than python code.
  • But, in many places, for numeric computations we already use numpy. Numpy is actually a C++ library with support of SIMD instructions. So, the performance of python-numpy code is about 1:1 to performance of C++ Eigen code (some functions are slower in numpy, other are slower in Eigen).

So my conclusions for now are:

  • It does not worth rewriting LinearSpline/CubicSpline/Spline2D classes in C++, as they are actually mostly written in C++ already (by usage of numpy). The main way to improve performance of nodes that use these is to process lesser amounts of data in most cases.
  • It could worth rewriting some code that processes a lot of data with non-numerical algorithms, in C++. But I do not know such places in Sverchok.
  • If you see some node / class in Sverchok, that does some numerical computations, and you want to improve it's performance - the step 1 is to use numpy.

Will write some other thoughts later...

Ответственный
Назначить
Оценка трудозатрат