Veeva Systems Founder and CEO Peter Gassner rings the opening bell at the New York Stock Exchange to celebrate the company's IPO on October 16, 2013 in New York City.

Small-cap stocks have been the place to be invested in this year relative to the large-cap names, and two investors seem to have cracked the code on them.

Amy Zhang of Alger and Sandy Villere of Villere & Co. are portfolio managers invested in small-cap stocks that have outperformed their peers. The Alger Small Cap Focus Fund Class A (AOFAX) has returned nearly 31 percent to investors and ranks in the first percentile of the “small growth” category, according to data from Morningstar. Meanwhile, the Villere Balanced Fund (VILLX) has posted a return of 12.9 percent this year and ranks in the first percentile among balanced funds with 70-to-85 percent equity allocation.

Their portfolios’ strong performances come as small caps have thoroughly outperformed the large-cap stocks. The Russell 2000 index is up about 11 percent this year and hit a record high on July 10 while the is up just under 5 percent in 2018.

However, not many people think of investing in the smaller stocks since they are not as popular and are not talked about nearly as much as the larger companies. Small caps also tend to be more volatile than large-cap stocks given their size. CNBC talked to Zhang and Villere about how they pick stocks and their investment process.

Zhang said she tries to find companies “that have a competitive advantage over their peers,” can disrupt industries “but are also sustainable,” and have strong financials.

One example of such a company is Guidewire Software, a company that makes software for insurance companies, Zhang said. Guidewire can benefit as the insurance industry is in the “early phase of reducing costs and improving revenue by replacing antiquated [information technology] infrastructure. The addressable market is very large, close to $8 billion, with very low penetration today,” she said.

Guidewire also generates lots of cash and invests heavily on research and development “to stay at the cutting edge of innovation.” Shares of Guidewire are up more than 25 percent this year.

Zhang also highlighted Veeva Systems, a cloud-computing company that caters to pharmaceuticals, noting it “exemplifies what we look for in a company.” She said the company has a wide moat, or competitive advantage, and 20 percent annual revenue growth.

Veeva shares are up more than 50 percent in 2018 and Zhang said the stock has more room to run. “The addressable market is very large, close to $8 billion, with very low penetration today,” she said.

Guidewire and Veeva are two of the largest holdings in Zhang’s fund, with respective portfolio weights of 3.78 percent and 2.56 percent, Morningstar data shows.

Zhang has managed the AOFAX fund since February 2015. The four-star rated fund has $1.6 billion in assets under management and has returned nearly 19 percent over the past three years. The fund is also in the fourth percentile in its category over that time period.