Extract the Kernel of GNU TeXmacs with minimum modification. Git diffs on source code of this project should be easily backported to the SVN repo.
GSoC students all over the world are welcome to contribute on GNU TeXmacs starting from this project.
Kernel part subproject for GNU TeXmacs, GSoC only
/******************************************************************************
* MODULE : fast_alloc_test.cpp
* DESCRIPTION: Test the time allocated for memory, the correctness
* of the returned result is not tested due to the type
* of the return value.
* COPYRIGHT : (C) 2019 Ze Wang
*******************************************************************************
* This software falls under the GNU general public license version 3 or later.
* It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
* in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
******************************************************************************/
#include "gtest/gtest.h"
#include "fast_alloc.hpp"
#include "tm_configure.hpp"
struct Complex {
public:
double re, im;
Complex(double re_, double im_): re(re_), im(im_) {}
~Complex() {}
};
/******************************************************************************
* Tests on Common routines for memory. It mainly contains two functions
* fast_new and new.
******************************************************************************/
TEST(fast_alloc,time_new=fast_new+new_){
EXPECT_TRUE(tm_new<char>());
EXPECT_TRUE(tm_new<char>('a'));
EXPECT_TRUE(tm_new<Complex>(35.8, 26.2));
EXPECT_TRUE(tm_new<int>(1));
EXPECT_TRUE(tm_new<short int>(1));
EXPECT_TRUE(tm_new<long int>(1));
}
/******************************************************************************
* Tests on Common routines for functions fast_new.
******************************************************************************/
TEST(fast_alloc,fast_new){
EXPECT_TRUE(fast_new(sizeof(int)));
EXPECT_TRUE(fast_new(sizeof(double)));
EXPECT_TRUE(fast_new(sizeof(char)));
EXPECT_TRUE(fast_new(sizeof(Complex)));
EXPECT_TRUE(fast_new(sizeof(short int)));
EXPECT_TRUE(fast_new(sizeof(long int)));
}
https://blog.csdn.net/zdy0_2004/article/details/56679754
http://www.cnblogs.com/coderzh/archive/2009/04/06/1426758.html
http://www.cnblogs.com/coderzh/archive/2009/04/08/1431297.html
http://www.cnblogs.com/coderzh/archive/2009/04/11/1433744.html
http://www.cnblogs.com/coderzh/archive/2009/04/12/1434155.html
Benchmark is Google Benchmark, which is mainly used to test the benchmark function of functions in C++.
A great example is as follows.
demo.cpp:
#include <benchmark/benchmark.h>
#include <iostream>
#include <string>
using namespace std;
void demo()
{
string str = "hello world";
str.size();
}
static void BM_demo(benchmark::State& state) {
for (auto _ : state)
demo();
}
// Register the function as a benchmark
BENCHMARK(BM_demo); //register test function
BENCHMARK_MAIN(); //program entry
In the code above, demo() is the function to be tested. static void BM_demo(...) is a part of the benchmark framework, which is responsible for testing the performance of the function demo().
In the result above, the first column is the program name, the second column is the clock time that iterates once, the third column is the CPU time that iterates once, and the fourth column is the number of iterations of the loop.
In this project, a basic cpp file is list_bench.cpp. This is the code.
#include <benchmark/benchmark.h>
#include "list.hpp"
static list<long> gen(int64_t n) {
auto normal = list<long>();
for (long i=0; i<n; i++)
normal << i;
return normal;
}
static void N (benchmark::State& state) {
auto list = gen(state.range(0));
for (auto _ : state)
N (list);
}
BENCHMARK (N)
->Arg(1)
->Arg(2)
->Arg(4)
->Arg(8)
->Arg(16)
->Arg(32)
->Arg(64)
->Arg(128)
->Arg(256)
->Arg(512)
->Arg(1024);
Gen(...) is used to generate a linked list, static void N(...) function is used to test the performance of the N(list) function.
According to the official GitHub installation instructions, we need to install Qt and guile1.8, then download the project code and build it with the command [cmake], Finally use the command [make] to install TeXmac. The difficult steps are [install Qt, install guile and install cmake], as explained below.
Install Qt
[Qt: Qt is a cross-platform C++ application development framework. It is widely used to develop GUI programs, which in this case is also called component toolbox. It can also be used to develop non-GUI programs such as console tools and servers.
Qt Creator: Qt Creator is a cross-platform integrated development environment, especially for Qt developers, which is a part of the Qt SDK. It can be run on Windows, Linux/X11 and Mac OS X desktop operating systems, allowing developers to create applications for desktop environments and mobile device platforms. It includes a visual debugging tool and an integrated GUI layout and shape designer. ]
The installation package used is qt-opensource-linux-x64-5.11.3.run
Installation command:
chmod +x qt.......
./qt......
You can refer to this link [http://www.cnblogs.com/huicanlin/p/5279089.html] for configuration.
Install guile
[Scheme is a programming language, and Guile (Scheme interpreter and library) converts it into an embedded scripting language, which is a great way to introduce dynamics into static applications. It is powerful in building scalable applications.ใ
Three guile-related packages have been downloaded, namely guile-1.8_1.8.8+1-10_amd64.deb, guile-1.8-libs_1.8.8+1-10_amd64.deb, and guile-1.8-dev_1.8.8+1-10_amd64. Deb;
The first two packages are currently installed and no error is reported.
Install cmake
[cmake: CMake is an open source cross-platform automation building system for managing software builds and is not dependent on a particular compiler. It can support multiple levels of directories, multiple applications, and multiple libraries. It uses configuration files to control the construction process in a similar way to Unix make, except that cmake's configuration file is named CMakeLists.txt. ใ
First, in ubuntu, enter the command [sudo apt-get install cmake], which will install a lower version of cmake, which generally needs to be upgraded by:
sudo apt-get upgrade
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:george-edison55/cmake-3.x
sudo apt-get update
[Intractable disease: apt-get install xx can not be successfully installed due to dependent package reasons]
The solution:
sudo apt-get -f autoremove
In the process of analyzing the code, I found that I need to master the cmake syntax, the relevant cmake learning links are as follows:
https://github.com/Akagi201/learning-cmake
Https://github.com/ttroy50/cmake-examples
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.