I did stuff
This commit is contained in:
parent
0b1383c5b6
commit
cb0f7855b2
|
@ -48,9 +48,10 @@ There are two most important geometry classes in THREE.js:
|
||||||
|
|
||||||
\subsection{Rust}
|
\subsection{Rust}
|
||||||
|
|
||||||
In this section, we explain the specificities of Rust and why it is a great language for those tasks.
|
\subsubsection{Borrow checker}
|
||||||
|
|
||||||
|
In this section, we explain the specificities of Rust and why it is a great language for writing efficient native software safely.
|
||||||
|
|
||||||
\subsubsection{Specificity of Rust}
|
|
||||||
Rust is a system programming language focused on safety.
|
Rust is a system programming language focused on safety.
|
||||||
It is made to be efficient (and effectively has performances comparable to C or C++) but with some extra features.
|
It is made to be efficient (and effectively has performances comparable to C or C++) but with some extra features.
|
||||||
C++ users might see it as a language like C++ but that forbids undefined behaviours.\footnote{in Rust, when you need to execute code that might lead to undefined behaviours, you need to put it inside an \texttt{unsafe} block. Many operations will not be available outside an \texttt{unsafe} block (e.g., dereferencing a pointer, or mutating a static variable). The idea is that you can use \texttt{unsafe} blocks when you require it, but you should avoid it as much as possible and when you do it, you must be particularly careful.}
|
C++ users might see it as a language like C++ but that forbids undefined behaviours.\footnote{in Rust, when you need to execute code that might lead to undefined behaviours, you need to put it inside an \texttt{unsafe} block. Many operations will not be available outside an \texttt{unsafe} block (e.g., dereferencing a pointer, or mutating a static variable). The idea is that you can use \texttt{unsafe} blocks when you require it, but you should avoid it as much as possible and when you do it, you must be particularly careful.}
|
||||||
|
@ -114,13 +115,35 @@ And effectively, the borrow checker will crash the compiler with the error in Li
|
||||||
This example is one of the many examples of how powerful the borrow checker is: in Rust code, there can be no dangling reference, and all the segmentation faults coming from them are detected by the compiler.
|
This example is one of the many examples of how powerful the borrow checker is: in Rust code, there can be no dangling reference, and all the segmentation faults coming from them are detected by the compiler.
|
||||||
The borrow checker may seem like an enemy to newcomers because it often rejects code that seem correct, but once you get used to it, you understand what is the problem with the code and either fix the problem easily, or realise that the whole architecture is wrong and understand why.
|
The borrow checker may seem like an enemy to newcomers because it often rejects code that seem correct, but once you get used to it, you understand what is the problem with the code and either fix the problem easily, or realise that the whole architecture is wrong and understand why.
|
||||||
|
|
||||||
|
It is probably for those reasons that Rust is the \emph{most loved programming language} according to the Stack Overflow Developer Survey in~\citeyear{so-survey-2016,so-survey-2017,so-survey-2018} and~\citeyear{so-survey-2019}.
|
||||||
|
|
||||||
\subsubsection{Tooling}
|
\subsubsection{Tooling}
|
||||||
|
|
||||||
Even better, Rust comes with great tooling.
|
Even better, Rust comes with great tooling.
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item \href{https://github.com/rust-lang/rust}{\textbf{\texttt{rustc}}} is the Rust compiler. It is very confortable due to the nice error messages it displays.
|
\item \href{https://github.com/rust-lang/rust}{\textbf{\texttt{rustc}}} is the Rust compiler. It is very comfortable due to the nice error messages it displays.
|
||||||
\item \href{https://github.com/rust-lang/cargo}{\textbf{\texttt{cargo}}} is the official Rust's project and package manager. It manages compilation, dependencies, documentation, tests, etc.
|
\item \href{https://github.com/rust-lang/cargo}{\textbf{\texttt{cargo}}} is the official Rust's project and package manager. It manages compilation, dependencies, documentation, tests, etc.
|
||||||
\item \href{https://github.com/racer-rust/racer}{\textbf{\texttt{racer}}}, \href{https://github.com/rust-lang/rls}{\textbf{\texttt{rls}} (Rust Language Server)} and \href{https://github.com/rust-analyzer/rust-analyzer}{\textbf{\texttt{rust-analyzer}}} are software that manage automatic compilation to display errors in code editors as well as providing semantic code completion.
|
\item \href{https://github.com/racer-rust/racer}{\textbf{\texttt{racer}}}, \href{https://github.com/rust-lang/rls}{\textbf{\texttt{rls}} (Rust Language Server)} and \href{https://github.com/rust-analyzer/rust-analyzer}{\textbf{\texttt{rust-analyzer}}} are software that manage automatic compilation to display errors in code editors as well as providing semantic code completion.
|
||||||
\item \href{https://github.com/rust-lang/rustfmt}{\textbf{\texttt{rustfmt}}} auto formats code.
|
\item \href{https://github.com/rust-lang/rustfmt}{\textbf{\texttt{rustfmt}}} auto formats code.
|
||||||
\item \href{https://github.com/rust-lang/rust-clippy}{\textbf{\texttt{clippy}}} is a linter that detects unidiomatic code and suggests modifications.
|
\item \href{https://github.com/rust-lang/rust-clippy}{\textbf{\texttt{clippy}}} is a linter that detects unidiomatic code and suggests modifications.
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
It is probably for those reasons that Rust is the \emph{most loved programming language} according to the Stack Overflow Developper Survey in~\citeyear{so-survey-2016,so-survey-2017,so-survey-2018} and~\citeyear{so-survey-2019}.
|
|
||||||
|
\subsubsection{Glium}
|
||||||
|
|
||||||
|
When we need to perform rendering for 3D content analysis or for evaluation, we use the \href{https://github.com/glium/glium}{\texttt{glium}} library.
|
||||||
|
Glium has many advantages over using raw OpenGL calls.
|
||||||
|
Its objectives are:
|
||||||
|
|
||||||
|
\begin{itemize}
|
||||||
|
\item to be easy to use: it exposes functions that are higher level than raw OpenGL calls, but still low enough level to let the developer free;
|
||||||
|
\item to be safe: debugging OpenGL code can be a nightmare, and glium does its best to use the borrow checker to its advantage to avoid OpenGL bugs;
|
||||||
|
\item to be fast: the binary produced use optimized OpenGL functions calls;
|
||||||
|
\item to be compatible: glium seeks to support the latest versions of OpenGL functions and falls back to older functions if the most recent ones are not supported on the device.
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
\subsubsection{Conclusion}
|
||||||
|
|
||||||
|
In our work, many tasks will consist in 3D content analysis, reorganising and 3D rendering evaluation.
|
||||||
|
Many of these tasks require long computations, lasting from hours to entire days.
|
||||||
|
To perform them, we need a programming language that has best performances (Rust has comparable performance with C or C++) and the extra features that Rust provides ease development tremendously, and this is why we use Rust for all tasks that do not require having a web interface.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue